Average Error: 10.6 → 1.0
Time: 13.8s
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.6
Target0.6
Herbie1.0
\[\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.6

    \[x + \frac{\left(y - z\right) \cdot t}{a - z} \]
  2. Applied egg-rr1.2

    \[\leadsto x + \color{blue}{\frac{y - z}{a - z} \cdot t} \]
  3. Taylor expanded in y around 0 10.6

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

    \[\leadsto x + \color{blue}{\frac{t}{\frac{a - z}{y - z}}} \]
    Proof
    (/.f64 t (/.f64 (-.f64 a z) (-.f64 y z))): 0 points increase in error, 0 points decrease in error
    (Rewrite<= associate-/l*_binary64 (/.f64 (*.f64 t (-.f64 y z)) (-.f64 a z))): 68 points increase in error, 34 points decrease in error
    (/.f64 (Rewrite=> *-commutative_binary64 (*.f64 (-.f64 y z) t)) (-.f64 a z)): 0 points increase in error, 0 points decrease in error
    (Rewrite=> associate-/l*_binary64 (/.f64 (-.f64 y z) (/.f64 (-.f64 a z) t))): 47 points increase in error, 84 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))): 36 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)))): 48 points increase in error, 20 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
  5. Final simplification1.0

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

Alternatives

Alternative 1
Error24.5
Cost2228
\[\begin{array}{l} t_1 := x + \frac{t}{\frac{a}{y}}\\ t_2 := z \cdot \frac{-t}{a - z}\\ \mathbf{if}\;t \leq -1.5 \cdot 10^{+158}:\\ \;\;\;\;t_2\\ \mathbf{elif}\;t \leq -6.227950273855624 \cdot 10^{+61}:\\ \;\;\;\;t_1\\ \mathbf{elif}\;t \leq -3.1272969553639392 \cdot 10^{+44}:\\ \;\;\;\;x + t\\ \mathbf{elif}\;t \leq -170768.39121455088:\\ \;\;\;\;\frac{t}{\frac{a - z}{y}}\\ \mathbf{elif}\;t \leq -0.011652457230334095:\\ \;\;\;\;t_1\\ \mathbf{elif}\;t \leq -1.2648237186566223 \cdot 10^{-54}:\\ \;\;\;\;x + t\\ \mathbf{elif}\;t \leq -1.7307456016758324 \cdot 10^{-71}:\\ \;\;\;\;\frac{t \cdot y}{a - z}\\ \mathbf{elif}\;t \leq -3.081690164998204 \cdot 10^{-92}:\\ \;\;\;\;x - t \cdot \frac{y}{z}\\ \mathbf{elif}\;t \leq -3.705197976941999 \cdot 10^{-135}:\\ \;\;\;\;x + t\\ \mathbf{elif}\;t \leq -1.4997798156817209 \cdot 10^{-232}:\\ \;\;\;\;x + \frac{t \cdot y}{a}\\ \mathbf{elif}\;t \leq 5.335621312023246 \cdot 10^{-18}:\\ \;\;\;\;x + t\\ \mathbf{elif}\;t \leq 7.247405077306269 \cdot 10^{+83}:\\ \;\;\;\;x + t \cdot \frac{y}{a}\\ \mathbf{elif}\;t \leq 7.6 \cdot 10^{+201}:\\ \;\;\;\;\frac{t}{z} \cdot \left(z - y\right)\\ \mathbf{else}:\\ \;\;\;\;t_2\\ \end{array} \]
Alternative 2
Error14.2
Cost1368
\[\begin{array}{l} t_1 := x + \frac{t \cdot y}{a - z}\\ t_2 := \frac{y - z}{\frac{a - z}{t}}\\ t_3 := x - t \cdot \frac{z}{a - z}\\ \mathbf{if}\;t \leq -1 \cdot 10^{+170}:\\ \;\;\;\;t_2\\ \mathbf{elif}\;t \leq -2.911823397209678 \cdot 10^{+83}:\\ \;\;\;\;t_1\\ \mathbf{elif}\;t \leq -3.1272969553639392 \cdot 10^{+44}:\\ \;\;\;\;t_3\\ \mathbf{elif}\;t \leq -170768.39121455088:\\ \;\;\;\;t_2\\ \mathbf{elif}\;t \leq 8.064234660872697 \cdot 10^{-59}:\\ \;\;\;\;t_1\\ \mathbf{elif}\;t \leq 3.836879740749064 \cdot 10^{+50}:\\ \;\;\;\;t_3\\ \mathbf{else}:\\ \;\;\;\;t_2\\ \end{array} \]
Alternative 3
Error14.3
Cost1368
\[\begin{array}{l} t_1 := x + \frac{t \cdot y}{a - z}\\ t_2 := \frac{y - z}{\frac{a - z}{t}}\\ t_3 := x - t \cdot \frac{z}{a - z}\\ \mathbf{if}\;t \leq -1 \cdot 10^{+170}:\\ \;\;\;\;t_2\\ \mathbf{elif}\;t \leq -2.911823397209678 \cdot 10^{+83}:\\ \;\;\;\;t_1\\ \mathbf{elif}\;t \leq -3.1272969553639392 \cdot 10^{+44}:\\ \;\;\;\;t_3\\ \mathbf{elif}\;t \leq -170768.39121455088:\\ \;\;\;\;t_2\\ \mathbf{elif}\;t \leq 8.064234660872697 \cdot 10^{-59}:\\ \;\;\;\;t_1\\ \mathbf{elif}\;t \leq 3.836879740749064 \cdot 10^{+50}:\\ \;\;\;\;t_3\\ \mathbf{else}:\\ \;\;\;\;\left(y - z\right) \cdot \frac{t}{a - z}\\ \end{array} \]
Alternative 4
Error18.8
Cost1104
\[\begin{array}{l} t_1 := \frac{y - z}{\frac{a - z}{t}}\\ \mathbf{if}\;t \leq -1.4 \cdot 10^{+144}:\\ \;\;\;\;t_1\\ \mathbf{elif}\;t \leq -3.705197976941999 \cdot 10^{-135}:\\ \;\;\;\;x + t\\ \mathbf{elif}\;t \leq -1.4997798156817209 \cdot 10^{-232}:\\ \;\;\;\;x + \frac{t \cdot y}{a}\\ \mathbf{elif}\;t \leq 2.3275525715736446 \cdot 10^{+36}:\\ \;\;\;\;x + t\\ \mathbf{else}:\\ \;\;\;\;t_1\\ \end{array} \]
Alternative 5
Error21.2
Cost976
\[\begin{array}{l} \mathbf{if}\;z \leq -6.389134458584936 \cdot 10^{-136}:\\ \;\;\;\;x + t\\ \mathbf{elif}\;z \leq 4.4834088169291326 \cdot 10^{-116}:\\ \;\;\;\;x\\ \mathbf{elif}\;z \leq 3.267695942662213 \cdot 10^{-92}:\\ \;\;\;\;x + t\\ \mathbf{elif}\;z \leq 4.813118325158483 \cdot 10^{-18}:\\ \;\;\;\;\left(y - z\right) \cdot \frac{t}{a}\\ \mathbf{else}:\\ \;\;\;\;x + t\\ \end{array} \]
Alternative 6
Error21.2
Cost976
\[\begin{array}{l} \mathbf{if}\;z \leq -6.389134458584936 \cdot 10^{-136}:\\ \;\;\;\;x + t\\ \mathbf{elif}\;z \leq 4.4834088169291326 \cdot 10^{-116}:\\ \;\;\;\;x\\ \mathbf{elif}\;z \leq 3.267695942662213 \cdot 10^{-92}:\\ \;\;\;\;x + t\\ \mathbf{elif}\;z \leq 4.813118325158483 \cdot 10^{-18}:\\ \;\;\;\;\frac{t \cdot \left(y - z\right)}{a}\\ \mathbf{else}:\\ \;\;\;\;x + t\\ \end{array} \]
Alternative 7
Error11.1
Cost840
\[\begin{array}{l} t_1 := x + t \cdot \left(1 - \frac{y}{z}\right)\\ \mathbf{if}\;z \leq -6.097092609219803 \cdot 10^{-66}:\\ \;\;\;\;t_1\\ \mathbf{elif}\;z \leq 4.813118325158483 \cdot 10^{-18}:\\ \;\;\;\;x + \frac{t}{\frac{a}{y}}\\ \mathbf{else}:\\ \;\;\;\;t_1\\ \end{array} \]
Alternative 8
Error11.5
Cost840
\[\begin{array}{l} t_1 := x + t \cdot \frac{y - z}{a}\\ \mathbf{if}\;a \leq -2.9713530403000132 \cdot 10^{+85}:\\ \;\;\;\;t_1\\ \mathbf{elif}\;a \leq 1.7448691087122759 \cdot 10^{-22}:\\ \;\;\;\;x + t \cdot \left(1 - \frac{y}{z}\right)\\ \mathbf{else}:\\ \;\;\;\;t_1\\ \end{array} \]
Alternative 9
Error10.2
Cost840
\[\begin{array}{l} \mathbf{if}\;z \leq -2.3574160452705315 \cdot 10^{-119}:\\ \;\;\;\;x - t \cdot \frac{z}{a - z}\\ \mathbf{elif}\;z \leq 4.813118325158483 \cdot 10^{-18}:\\ \;\;\;\;x + t \cdot \frac{y - z}{a}\\ \mathbf{else}:\\ \;\;\;\;x + t \cdot \left(1 - \frac{y}{z}\right)\\ \end{array} \]
Alternative 10
Error14.2
Cost712
\[\begin{array}{l} \mathbf{if}\;z \leq -6.097092609219803 \cdot 10^{-66}:\\ \;\;\;\;x + t\\ \mathbf{elif}\;z \leq 41934.82532304969:\\ \;\;\;\;x + \frac{t}{\frac{a}{y}}\\ \mathbf{else}:\\ \;\;\;\;x + t\\ \end{array} \]
Alternative 11
Error19.9
Cost456
\[\begin{array}{l} \mathbf{if}\;a \leq -3.0201992325784418 \cdot 10^{+147}:\\ \;\;\;\;x\\ \mathbf{elif}\;a \leq 9.288727179735059 \cdot 10^{+139}:\\ \;\;\;\;x + t\\ \mathbf{else}:\\ \;\;\;\;x\\ \end{array} \]
Alternative 12
Error26.8
Cost328
\[\begin{array}{l} \mathbf{if}\;x \leq -3.3125920853923143 \cdot 10^{-108}:\\ \;\;\;\;x\\ \mathbf{elif}\;x \leq 1.0754137245970405 \cdot 10^{-204}:\\ \;\;\;\;t\\ \mathbf{else}:\\ \;\;\;\;x\\ \end{array} \]
Alternative 13
Error51.2
Cost64
\[t \]

Error

Reproduce

herbie shell --seed 2022316 
(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))))