x + y \cdot \frac{z - t}{a - t}\begin{array}{l}
\mathbf{if}\;y \le -9.4186501671601072 \cdot 10^{28}:\\
\;\;\;\;\frac{1}{\frac{\frac{a - t}{z - t}}{y}} + x\\
\mathbf{elif}\;y \le 297107934094652.88:\\
\;\;\;\;\frac{1}{a - t} \cdot \left(y \cdot \left(z - t\right)\right) + x\\
\mathbf{else}:\\
\;\;\;\;\mathsf{fma}\left(y, \frac{z}{a - t} - \frac{t}{a - t}, x\right)\\
\end{array}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) {
double VAR;
if ((y <= -9.418650167160107e+28)) {
VAR = ((1.0 / (((a - t) / (z - t)) / y)) + x);
} else {
double VAR_1;
if ((y <= 297107934094652.9)) {
VAR_1 = (((1.0 / (a - t)) * (y * (z - t))) + x);
} else {
VAR_1 = fma(y, ((z / (a - t)) - (t / (a - t))), x);
}
VAR = VAR_1;
}
return VAR;
}




Bits error versus x




Bits error versus y




Bits error versus z




Bits error versus t




Bits error versus a
Results
| Original | 1.4 |
|---|---|
| Target | 0.4 |
| Herbie | 0.5 |
if y < -9.418650167160107e+28Initial program 0.4
Simplified0.4
rmApplied clear-num0.6
rmApplied fma-udef0.6
Simplified0.6
rmApplied clear-num0.7
if -9.418650167160107e+28 < y < 297107934094652.9Initial program 2.1
Simplified2.1
rmApplied clear-num2.2
rmApplied fma-udef2.2
Simplified1.9
rmApplied div-inv1.9
Applied *-un-lft-identity1.9
Applied times-frac0.5
Simplified0.5
if 297107934094652.9 < y Initial program 0.6
Simplified0.6
rmApplied div-sub0.5
Final simplification0.5
herbie shell --seed 2020092 +o rules:numerics
(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 (- a t)))) (+ x (* y (/ (- z t) (- a t))))))
(+ x (* y (/ (- z t) (- a t)))))