Average Error: 1.6 → 1.4
Time: 7.4s
Precision: binary64
Cost: 704
\[x + y \cdot \frac{z - t}{a - t} \]
\[x + \frac{y}{\frac{a - t}{z - t}} \]
(FPCore (x y z t a) :precision binary64 (+ x (* y (/ (- z t) (- a t)))))
(FPCore (x y z t a) :precision binary64 (+ x (/ y (/ (- a t) (- z t)))))
double code(double x, double y, double z, double t, double a) {
	return x + (y * ((z - t) / (a - t)));
}
double code(double x, double y, double z, double t, double a) {
	return x + (y / ((a - t) / (z - t)));
}
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) / (a - t)))
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 / ((a - t) / (z - t)))
end function
public static double code(double x, double y, double z, double t, double a) {
	return x + (y * ((z - t) / (a - t)));
}
public static double code(double x, double y, double z, double t, double a) {
	return x + (y / ((a - t) / (z - t)));
}
def code(x, y, z, t, a):
	return x + (y * ((z - t) / (a - t)))
def code(x, y, z, t, a):
	return x + (y / ((a - t) / (z - t)))
function code(x, y, z, t, a)
	return Float64(x + Float64(y * Float64(Float64(z - t) / Float64(a - t))))
end
function code(x, y, z, t, a)
	return Float64(x + Float64(y / Float64(Float64(a - t) / Float64(z - t))))
end
function tmp = code(x, y, z, t, a)
	tmp = x + (y * ((z - t) / (a - t)));
end
function tmp = code(x, y, z, t, a)
	tmp = x + (y / ((a - t) / (z - t)));
end
code[x_, y_, z_, t_, a_] := N[(x + N[(y * N[(N[(z - t), $MachinePrecision] / N[(a - t), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]
code[x_, y_, z_, t_, a_] := N[(x + N[(y / N[(N[(a - t), $MachinePrecision] / N[(z - t), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]
x + y \cdot \frac{z - t}{a - t}
x + \frac{y}{\frac{a - t}{z - t}}

Error

Try it out

Your Program's Arguments

Results

Enter valid numbers for all inputs

Target

Original1.6
Target0.5
Herbie1.4
\[\begin{array}{l} \mathbf{if}\;y < -8.508084860551241 \cdot 10^{-17}:\\ \;\;\;\;x + y \cdot \frac{z - t}{a - t}\\ \mathbf{elif}\;y < 2.894426862792089 \cdot 10^{-49}:\\ \;\;\;\;x + \left(y \cdot \left(z - t\right)\right) \cdot \frac{1}{a - t}\\ \mathbf{else}:\\ \;\;\;\;x + y \cdot \frac{z - t}{a - t}\\ \end{array} \]

Derivation

  1. Initial program 1.6

    \[x + y \cdot \frac{z - t}{a - t} \]
  2. Applied egg-rr1.4

    \[\leadsto x + \color{blue}{\frac{y}{\frac{a - t}{z - t}}} \]
  3. Final simplification1.4

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

Alternatives

Alternative 1
Error10.5
Cost840
\[\begin{array}{l} t_1 := x - y \cdot \frac{t}{a - t}\\ \mathbf{if}\;t \leq -4.071511416001858 \cdot 10^{-8}:\\ \;\;\;\;t_1\\ \mathbf{elif}\;t \leq 6.314898097072049 \cdot 10^{-98}:\\ \;\;\;\;x + \frac{y}{\frac{a}{z}}\\ \mathbf{else}:\\ \;\;\;\;t_1\\ \end{array} \]
Alternative 2
Error11.3
Cost840
\[\begin{array}{l} \mathbf{if}\;t \leq -4.071511416001858 \cdot 10^{-8}:\\ \;\;\;\;x - y \cdot \frac{t}{a - t}\\ \mathbf{elif}\;t \leq 4.462849520098056 \cdot 10^{-65}:\\ \;\;\;\;x + \frac{y}{\frac{a}{z}}\\ \mathbf{else}:\\ \;\;\;\;x - \left(y \cdot \frac{z}{t} - y\right)\\ \end{array} \]
Alternative 3
Error11.3
Cost840
\[\begin{array}{l} \mathbf{if}\;t \leq -4.071511416001858 \cdot 10^{-8}:\\ \;\;\;\;x - \frac{y}{\frac{a}{t} + -1}\\ \mathbf{elif}\;t \leq 4.462849520098056 \cdot 10^{-65}:\\ \;\;\;\;x + \frac{y}{\frac{a}{z}}\\ \mathbf{else}:\\ \;\;\;\;x - \left(y \cdot \frac{z}{t} - y\right)\\ \end{array} \]
Alternative 4
Error19.2
Cost712
\[\begin{array}{l} \mathbf{if}\;t \leq -2.2809849630464558 \cdot 10^{+53}:\\ \;\;\;\;x + y\\ \mathbf{elif}\;t \leq 1.283819516414495 \cdot 10^{-61}:\\ \;\;\;\;x - \frac{y}{\frac{a}{t}}\\ \mathbf{else}:\\ \;\;\;\;x + y\\ \end{array} \]
Alternative 5
Error14.3
Cost712
\[\begin{array}{l} \mathbf{if}\;t \leq -2.2809849630464558 \cdot 10^{+53}:\\ \;\;\;\;x + y\\ \mathbf{elif}\;t \leq 1.283819516414495 \cdot 10^{-61}:\\ \;\;\;\;x + \frac{y}{\frac{a}{z}}\\ \mathbf{else}:\\ \;\;\;\;x + y\\ \end{array} \]
Alternative 6
Error19.5
Cost456
\[\begin{array}{l} \mathbf{if}\;t \leq -1.985141535833203 \cdot 10^{-93}:\\ \;\;\;\;x + y\\ \mathbf{elif}\;t \leq 4.462849520098056 \cdot 10^{-65}:\\ \;\;\;\;x\\ \mathbf{else}:\\ \;\;\;\;x + y\\ \end{array} \]
Alternative 7
Error28.5
Cost64
\[x \]

Error

Reproduce

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

  :herbie-target
  (if (< y -8.508084860551241e-17) (+ x (* y (/ (- z t) (- a t)))) (if (< y 2.894426862792089e-49) (+ x (* (* y (- z t)) (/ 1.0 (- a t)))) (+ x (* y (/ (- z t) (- a t))))))

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