Average Error: 1.6 → 1.6
Time: 11.3s
Precision: binary64
Cost: 704
\[x + y \cdot \frac{z - t}{z - a} \]
\[x + y \cdot \frac{z - t}{z - a} \]
(FPCore (x y z t a) :precision binary64 (+ x (* y (/ (- z t) (- z a)))))
(FPCore (x y z t a) :precision binary64 (+ x (* y (/ (- z t) (- z a)))))
double code(double x, double y, double z, double t, double a) {
	return x + (y * ((z - t) / (z - a)));
}
double code(double x, double y, double z, double t, double a) {
	return x + (y * ((z - t) / (z - a)));
}
real(8) function code(x, y, z, t, a)
    real(8), intent (in) :: x
    real(8), intent (in) :: y
    real(8), intent (in) :: z
    real(8), intent (in) :: t
    real(8), intent (in) :: a
    code = x + (y * ((z - t) / (z - a)))
end function
real(8) function code(x, y, z, t, a)
    real(8), intent (in) :: x
    real(8), intent (in) :: y
    real(8), intent (in) :: z
    real(8), intent (in) :: t
    real(8), intent (in) :: a
    code = x + (y * ((z - t) / (z - a)))
end function
public static double code(double x, double y, double z, double t, double a) {
	return x + (y * ((z - t) / (z - a)));
}
public static double code(double x, double y, double z, double t, double a) {
	return x + (y * ((z - t) / (z - a)));
}
def code(x, y, z, t, a):
	return x + (y * ((z - t) / (z - a)))
def code(x, y, z, t, a):
	return x + (y * ((z - t) / (z - a)))
function code(x, y, z, t, a)
	return Float64(x + Float64(y * Float64(Float64(z - t) / Float64(z - a))))
end
function code(x, y, z, t, a)
	return Float64(x + Float64(y * Float64(Float64(z - t) / Float64(z - a))))
end
function tmp = code(x, y, z, t, a)
	tmp = x + (y * ((z - t) / (z - a)));
end
function tmp = code(x, y, z, t, a)
	tmp = x + (y * ((z - t) / (z - a)));
end
code[x_, y_, z_, t_, a_] := N[(x + N[(y * N[(N[(z - t), $MachinePrecision] / N[(z - a), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]
code[x_, y_, z_, t_, a_] := N[(x + N[(y * N[(N[(z - t), $MachinePrecision] / N[(z - a), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]
x + y \cdot \frac{z - t}{z - a}
x + y \cdot \frac{z - t}{z - a}

Error

Try it out

Your Program's Arguments

Results

Enter valid numbers for all inputs

Target

Original1.6
Target1.4
Herbie1.6
\[x + \frac{y}{\frac{z - a}{z - t}} \]

Derivation

  1. Initial program 1.6

    \[x + y \cdot \frac{z - t}{z - a} \]
  2. Final simplification1.6

    \[\leadsto x + y \cdot \frac{z - t}{z - a} \]

Alternatives

Alternative 1
Error13.1
Cost3028
\[\begin{array}{l} t_1 := x - \frac{y}{\frac{z}{t}}\\ t_2 := \frac{z - t}{z - a}\\ \mathbf{if}\;t_2 \leq -5 \cdot 10^{+60}:\\ \;\;\;\;\frac{y \cdot t}{a - z}\\ \mathbf{elif}\;t_2 \leq -20000000000:\\ \;\;\;\;t_1\\ \mathbf{elif}\;t_2 \leq -0.002:\\ \;\;\;\;y \cdot t_2\\ \mathbf{elif}\;t_2 \leq 2 \cdot 10^{-21}:\\ \;\;\;\;x - \frac{y \cdot z}{a}\\ \mathbf{elif}\;t_2 \leq 10^{+22}:\\ \;\;\;\;x + y\\ \mathbf{else}:\\ \;\;\;\;t_1\\ \end{array} \]
Alternative 2
Error13.3
Cost2512
\[\begin{array}{l} t_1 := \frac{z - t}{z - a}\\ \mathbf{if}\;t_1 \leq -1 \cdot 10^{+59}:\\ \;\;\;\;\frac{y \cdot t}{a - z}\\ \mathbf{elif}\;t_1 \leq -0.002:\\ \;\;\;\;x + \frac{z - t}{\frac{z}{y}}\\ \mathbf{elif}\;t_1 \leq 2 \cdot 10^{-21}:\\ \;\;\;\;x - \frac{y \cdot z}{a}\\ \mathbf{elif}\;t_1 \leq 10^{+22}:\\ \;\;\;\;x + y\\ \mathbf{else}:\\ \;\;\;\;x - \frac{y}{\frac{z}{t}}\\ \end{array} \]
Alternative 3
Error2.8
Cost2188
\[\begin{array}{l} t_1 := \frac{z - t}{z - a}\\ \mathbf{if}\;t_1 \leq -500:\\ \;\;\;\;x - y \cdot \frac{t}{z - a}\\ \mathbf{elif}\;t_1 \leq 10^{-5}:\\ \;\;\;\;x + \frac{y}{a} \cdot \left(t - z\right)\\ \mathbf{elif}\;t_1 \leq 1.00000002:\\ \;\;\;\;x + y\\ \mathbf{else}:\\ \;\;\;\;x + \frac{y}{\frac{z - a}{-t}}\\ \end{array} \]
Alternative 4
Error2.9
Cost2124
\[\begin{array}{l} t_1 := \frac{z - t}{z - a}\\ t_2 := x - y \cdot \frac{t}{z - a}\\ \mathbf{if}\;t_1 \leq -500:\\ \;\;\;\;t_2\\ \mathbf{elif}\;t_1 \leq 10^{-5}:\\ \;\;\;\;x + \frac{y}{a} \cdot \left(t - z\right)\\ \mathbf{elif}\;t_1 \leq 1.00000002:\\ \;\;\;\;x + y\\ \mathbf{else}:\\ \;\;\;\;t_2\\ \end{array} \]
Alternative 5
Error5.5
Cost1609
\[\begin{array}{l} t_1 := \frac{z - t}{z - a}\\ \mathbf{if}\;t_1 \leq 10^{-5} \lor \neg \left(t_1 \leq 1.00000002\right):\\ \;\;\;\;x - y \cdot \frac{t}{z - a}\\ \mathbf{else}:\\ \;\;\;\;x + y\\ \end{array} \]
Alternative 6
Error15.2
Cost844
\[\begin{array}{l} \mathbf{if}\;z \leq -1.04 \cdot 10^{+80}:\\ \;\;\;\;x + y\\ \mathbf{elif}\;z \leq -1.02 \cdot 10^{-105}:\\ \;\;\;\;x - \frac{y \cdot t}{z}\\ \mathbf{elif}\;z \leq 1.8 \cdot 10^{+77}:\\ \;\;\;\;x + \frac{y}{\frac{a}{t}}\\ \mathbf{else}:\\ \;\;\;\;x + y\\ \end{array} \]
Alternative 7
Error15.2
Cost844
\[\begin{array}{l} \mathbf{if}\;z \leq -4.1 \cdot 10^{+78}:\\ \;\;\;\;x + y\\ \mathbf{elif}\;z \leq -1.02 \cdot 10^{-105}:\\ \;\;\;\;x - \frac{y}{\frac{z}{t}}\\ \mathbf{elif}\;z \leq 1.8 \cdot 10^{+77}:\\ \;\;\;\;x + \frac{y}{\frac{a}{t}}\\ \mathbf{else}:\\ \;\;\;\;x + y\\ \end{array} \]
Alternative 8
Error14.9
Cost712
\[\begin{array}{l} \mathbf{if}\;z \leq -1.95 \cdot 10^{-85}:\\ \;\;\;\;x + y\\ \mathbf{elif}\;z \leq 1.95 \cdot 10^{+77}:\\ \;\;\;\;x + y \cdot \frac{t}{a}\\ \mathbf{else}:\\ \;\;\;\;x + y\\ \end{array} \]
Alternative 9
Error14.8
Cost712
\[\begin{array}{l} \mathbf{if}\;z \leq -3 \cdot 10^{-84}:\\ \;\;\;\;x + y\\ \mathbf{elif}\;z \leq 2 \cdot 10^{+77}:\\ \;\;\;\;x + \frac{y}{\frac{a}{t}}\\ \mathbf{else}:\\ \;\;\;\;x + y\\ \end{array} \]
Alternative 10
Error23.9
Cost588
\[\begin{array}{l} \mathbf{if}\;t \leq -1.15 \cdot 10^{+225}:\\ \;\;\;\;\frac{-y}{\frac{z}{t}}\\ \mathbf{elif}\;t \leq -1.22 \cdot 10^{+60}:\\ \;\;\;\;x + y\\ \mathbf{elif}\;t \leq -3 \cdot 10^{-89}:\\ \;\;\;\;x\\ \mathbf{else}:\\ \;\;\;\;x + y\\ \end{array} \]
Alternative 11
Error20.6
Cost456
\[\begin{array}{l} \mathbf{if}\;z \leq -3.9 \cdot 10^{-97}:\\ \;\;\;\;x + y\\ \mathbf{elif}\;z \leq 8 \cdot 10^{-214}:\\ \;\;\;\;x\\ \mathbf{else}:\\ \;\;\;\;x + y\\ \end{array} \]
Alternative 12
Error29.3
Cost64
\[x \]

Error

Reproduce

herbie shell --seed 2022364 
(FPCore (x y z t a)
  :name "Graphics.Rendering.Plot.Render.Plot.Axis:renderAxisLine from plot-0.2.3.4, A"
  :precision binary64

  :herbie-target
  (+ x (/ y (/ (- z a) (- z t))))

  (+ x (* y (/ (- z t) (- z a)))))