x + \left(y - x\right) \cdot \frac{z}{t}\begin{array}{l}
\mathbf{if}\;x + \left(y - x\right) \cdot \frac{z}{t} \leq 4.4511333104284477 \cdot 10^{+307}:\\
\;\;\;\;x + \left(y - x\right) \cdot \frac{z}{t}\\
\mathbf{else}:\\
\;\;\;\;x + \left(\left(y - x\right) \cdot z\right) \cdot \frac{1}{t}\\
\end{array}(FPCore (x y z t) :precision binary64 (+ x (* (- y x) (/ z t))))
(FPCore (x y z t) :precision binary64 (if (<= (+ x (* (- y x) (/ z t))) 4.4511333104284477e+307) (+ x (* (- y x) (/ z t))) (+ x (* (* (- y x) z) (/ 1.0 t)))))
double code(double x, double y, double z, double t) {
return x + ((y - x) * (z / t));
}
double code(double x, double y, double z, double t) {
double tmp;
if ((x + ((y - x) * (z / t))) <= 4.4511333104284477e+307) {
tmp = x + ((y - x) * (z / t));
} else {
tmp = x + (((y - x) * z) * (1.0 / t));
}
return tmp;
}














Bits error versus x














Bits error versus y














Bits error versus z














Bits error versus t
Results
| Original | 2.0 |
|---|---|
| Target | 2.1 |
| Herbie | 1.3 |
| Alternative 1 | |
|---|---|
| Error | 0.9 |
| Cost | 39488 |
| Alternative 2 | |
|---|---|
| Error | 1.3 |
| Cost | 1409 |
| Alternative 3 | |
|---|---|
| Error | 2.0 |
| Cost | 576 |
| Alternative 4 | |
|---|---|
| Error | 3.1 |
| Cost | 1032 |
| Alternative 5 | |
|---|---|
| Error | 12.6 |
| Cost | 1032 |
| Alternative 6 | |
|---|---|
| Error | 12.5 |
| Cost | 1032 |
| Alternative 7 | |
|---|---|
| Error | 21.9 |
| Cost | 904 |
| Alternative 8 | |
|---|---|
| Error | 31.5 |
| Cost | 64 |
| Alternative 9 | |
|---|---|
| Error | 61.8 |
| Cost | 64 |
| Alternative 10 | |
|---|---|
| Error | 61.8 |
| Cost | 64 |

if (+.f64 x (*.f64 (-.f64 y x) (/.f64 z t))) < 4.4511333104284477e307Initial program 1.3
Simplified1.3
if 4.4511333104284477e307 < (+.f64 x (*.f64 (-.f64 y x) (/.f64 z t))) Initial program 60.3
rmApplied div-inv_binary64_1644360.3
Applied associate-*r*_binary64_163861.1
Simplified1.1
Final simplification1.3
herbie shell --seed 2021044
(FPCore (x y z t)
:name "Graphics.Rendering.Plot.Render.Plot.Axis:tickPosition from plot-0.2.3.4"
:precision binary64
:herbie-target
(if (< (* (- y x) (/ z t)) -1013646692435.8867) (+ x (/ (- y x) (/ t z))) (if (< (* (- y x) (/ z t)) 0.0) (+ x (/ (* (- y x) z) t)) (+ x (/ (- y x) (/ t z)))))
(+ x (* (- y x) (/ z t))))