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

Error

Try it out

Your Program's Arguments

Results

Enter valid numbers for all inputs

Target

Original10.7
Target0.5
Herbie1.2
\[\begin{array}{l} \mathbf{if}\;t < -1.0682974490174067 \cdot 10^{-39}:\\ \;\;\;\;x + \frac{y - z}{a - z} \cdot t\\ \mathbf{elif}\;t < 3.9110949887586375 \cdot 10^{-141}:\\ \;\;\;\;x + \frac{\left(y - z\right) \cdot t}{a - z}\\ \mathbf{else}:\\ \;\;\;\;x + \frac{y - z}{a - z} \cdot t\\ \end{array} \]

Derivation

  1. Initial program 10.7

    \[x + \frac{\left(y - z\right) \cdot t}{a - z} \]
  2. Taylor expanded in y around 0 10.7

    \[\leadsto x + \color{blue}{\left(\frac{y \cdot t}{a - z} + -1 \cdot \frac{t \cdot z}{a - z}\right)} \]
  3. Simplified1.4

    \[\leadsto x + \color{blue}{\frac{y - z}{a - z} \cdot t} \]
    Proof
    (*.f64 (/.f64 (-.f64 y z) (-.f64 a z)) t): 0 points increase in error, 0 points decrease in error
    (Rewrite<= associate-/r/_binary64 (/.f64 (-.f64 y z) (/.f64 (-.f64 a z) t))): 64 points increase in error, 52 points decrease in error
    (Rewrite=> div-sub_binary64 (-.f64 (/.f64 y (/.f64 (-.f64 a z) t)) (/.f64 z (/.f64 (-.f64 a z) t)))): 1 points increase in error, 2 points decrease in error
    (-.f64 (Rewrite<= associate-/l*_binary64 (/.f64 (*.f64 y t) (-.f64 a z))) (/.f64 z (/.f64 (-.f64 a z) t))): 38 points increase in error, 29 points decrease in error
    (-.f64 (/.f64 (*.f64 y t) (-.f64 a z)) (Rewrite<= associate-/l*_binary64 (/.f64 (*.f64 z t) (-.f64 a z)))): 52 points increase in error, 30 points decrease in error
    (-.f64 (/.f64 (*.f64 y t) (-.f64 a z)) (/.f64 (Rewrite<= *-commutative_binary64 (*.f64 t z)) (-.f64 a z))): 0 points increase in error, 0 points decrease in error
    (Rewrite<= unsub-neg_binary64 (+.f64 (/.f64 (*.f64 y t) (-.f64 a z)) (neg.f64 (/.f64 (*.f64 t z) (-.f64 a z))))): 0 points increase in error, 0 points decrease in error
    (+.f64 (/.f64 (*.f64 y t) (-.f64 a z)) (Rewrite<= mul-1-neg_binary64 (*.f64 -1 (/.f64 (*.f64 t z) (-.f64 a z))))): 0 points increase in error, 0 points decrease in error
  4. Applied egg-rr1.2

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

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

Alternatives

Alternative 1
Error21.1
Cost1500
\[\begin{array}{l} t_1 := x + y \cdot \frac{t}{a}\\ t_2 := \left(y - z\right) \cdot \frac{t}{a - z}\\ \mathbf{if}\;a \leq -4.997935541305529 \cdot 10^{+143}:\\ \;\;\;\;t_1\\ \mathbf{elif}\;a \leq -9.679751965422507 \cdot 10^{-52}:\\ \;\;\;\;x + t\\ \mathbf{elif}\;a \leq 2.9144370470767576 \cdot 10^{-181}:\\ \;\;\;\;x - t \cdot \frac{y}{z}\\ \mathbf{elif}\;a \leq 7.901588124760676 \cdot 10^{-78}:\\ \;\;\;\;t_2\\ \mathbf{elif}\;a \leq 2.202425690566314 \cdot 10^{-60}:\\ \;\;\;\;x + t\\ \mathbf{elif}\;a \leq 6.476904389233239 \cdot 10^{-29}:\\ \;\;\;\;x + \frac{t \cdot y}{a}\\ \mathbf{elif}\;a \leq 2.908115713570543 \cdot 10^{+25}:\\ \;\;\;\;t_2\\ \mathbf{else}:\\ \;\;\;\;t_1\\ \end{array} \]
Alternative 2
Error18.9
Cost844
\[\begin{array}{l} t_1 := x - t \cdot \frac{y}{z}\\ \mathbf{if}\;z \leq -1 \cdot 10^{-140}:\\ \;\;\;\;t_1\\ \mathbf{elif}\;z \leq 4.8643784894582903 \cdot 10^{-82}:\\ \;\;\;\;x + \frac{t}{\frac{a}{y}}\\ \mathbf{elif}\;z \leq 4.962097167430331 \cdot 10^{+59}:\\ \;\;\;\;t_1\\ \mathbf{else}:\\ \;\;\;\;x + t\\ \end{array} \]
Alternative 3
Error19.0
Cost844
\[\begin{array}{l} t_1 := x - t \cdot \frac{y}{z}\\ \mathbf{if}\;z \leq -1 \cdot 10^{-140}:\\ \;\;\;\;t_1\\ \mathbf{elif}\;z \leq 4.8643784894582903 \cdot 10^{-82}:\\ \;\;\;\;x + y \cdot \frac{t}{a}\\ \mathbf{elif}\;z \leq 4.962097167430331 \cdot 10^{+59}:\\ \;\;\;\;t_1\\ \mathbf{else}:\\ \;\;\;\;x + t\\ \end{array} \]
Alternative 4
Error12.5
Cost840
\[\begin{array}{l} t_1 := x + t \cdot \left(1 - \frac{y}{z}\right)\\ \mathbf{if}\;z \leq -1 \cdot 10^{-140}:\\ \;\;\;\;t_1\\ \mathbf{elif}\;z \leq 4.8643784894582903 \cdot 10^{-82}:\\ \;\;\;\;x + y \cdot \frac{t}{a}\\ \mathbf{else}:\\ \;\;\;\;t_1\\ \end{array} \]
Alternative 5
Error11.5
Cost840
\[\begin{array}{l} t_1 := x - t \cdot \frac{z}{a - z}\\ \mathbf{if}\;a \leq -4.792834872354502 \cdot 10^{-44}:\\ \;\;\;\;t_1\\ \mathbf{elif}\;a \leq 7.901588124760676 \cdot 10^{-78}:\\ \;\;\;\;x + t \cdot \left(1 - \frac{y}{z}\right)\\ \mathbf{else}:\\ \;\;\;\;t_1\\ \end{array} \]
Alternative 6
Error12.3
Cost840
\[\begin{array}{l} \mathbf{if}\;t \leq -2.259996706841697 \cdot 10^{+43}:\\ \;\;\;\;\left(y - z\right) \cdot \frac{t}{a - z}\\ \mathbf{elif}\;t \leq 1.346630671576964 \cdot 10^{-7}:\\ \;\;\;\;x + \frac{t \cdot y}{a - z}\\ \mathbf{else}:\\ \;\;\;\;x - t \cdot \frac{z}{a - z}\\ \end{array} \]
Alternative 7
Error20.7
Cost720
\[\begin{array}{l} \mathbf{if}\;z \leq -6.1168538326138154 \cdot 10^{-33}:\\ \;\;\;\;x + t\\ \mathbf{elif}\;z \leq 6.2 \cdot 10^{-211}:\\ \;\;\;\;x\\ \mathbf{elif}\;z \leq 4.8 \cdot 10^{-178}:\\ \;\;\;\;\frac{t}{\frac{a}{y}}\\ \mathbf{elif}\;z \leq 2.6748906124347994 \cdot 10^{+48}:\\ \;\;\;\;x\\ \mathbf{else}:\\ \;\;\;\;x + t\\ \end{array} \]
Alternative 8
Error20.7
Cost720
\[\begin{array}{l} \mathbf{if}\;z \leq -6.1168538326138154 \cdot 10^{-33}:\\ \;\;\;\;x + t\\ \mathbf{elif}\;z \leq 6.2 \cdot 10^{-211}:\\ \;\;\;\;x\\ \mathbf{elif}\;z \leq 4.8 \cdot 10^{-178}:\\ \;\;\;\;y \cdot \frac{t}{a}\\ \mathbf{elif}\;z \leq 2.6748906124347994 \cdot 10^{+48}:\\ \;\;\;\;x\\ \mathbf{else}:\\ \;\;\;\;x + t\\ \end{array} \]
Alternative 9
Error15.2
Cost712
\[\begin{array}{l} \mathbf{if}\;z \leq -2.9233660976385095 \cdot 10^{-30}:\\ \;\;\;\;x + t\\ \mathbf{elif}\;z \leq 5.919190106489295 \cdot 10^{+51}:\\ \;\;\;\;x + \frac{t \cdot y}{a}\\ \mathbf{else}:\\ \;\;\;\;x + t\\ \end{array} \]
Alternative 10
Error14.4
Cost712
\[\begin{array}{l} \mathbf{if}\;z \leq -2.9233660976385095 \cdot 10^{-30}:\\ \;\;\;\;x + t\\ \mathbf{elif}\;z \leq 5.919190106489295 \cdot 10^{+51}:\\ \;\;\;\;x + \frac{t}{\frac{a}{y}}\\ \mathbf{else}:\\ \;\;\;\;x + t\\ \end{array} \]
Alternative 11
Error20.2
Cost456
\[\begin{array}{l} \mathbf{if}\;z \leq -6.1168538326138154 \cdot 10^{-33}:\\ \;\;\;\;x + t\\ \mathbf{elif}\;z \leq 2.6748906124347994 \cdot 10^{+48}:\\ \;\;\;\;x\\ \mathbf{else}:\\ \;\;\;\;x + t\\ \end{array} \]
Alternative 12
Error27.0
Cost328
\[\begin{array}{l} \mathbf{if}\;t \leq -2.1 \cdot 10^{+171}:\\ \;\;\;\;t\\ \mathbf{elif}\;t \leq 4 \cdot 10^{+266}:\\ \;\;\;\;x\\ \mathbf{else}:\\ \;\;\;\;t\\ \end{array} \]
Alternative 13
Error51.5
Cost64
\[t \]

Error

Reproduce

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

  :herbie-target
  (if (< t -1.0682974490174067e-39) (+ x (* (/ (- y z) (- a z)) t)) (if (< t 3.9110949887586375e-141) (+ x (/ (* (- y z) t) (- a z))) (+ x (* (/ (- y z) (- a z)) t))))

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