x + y \cdot \frac{z - t}{a - t}\begin{array}{l}
\mathbf{if}\;y \le -3.1778304487720257 \cdot 10^{37}:\\
\;\;\;\;\mathsf{fma}\left(\frac{y}{a - t}, z - t, x\right)\\
\mathbf{elif}\;y \le 1.7883278228757425 \cdot 10^{-99}:\\
\;\;\;\;\mathsf{fma}\left(\frac{1}{a - t}, \frac{y}{\frac{1}{z - t}}, x\right)\\
\mathbf{else}:\\
\;\;\;\;\mathsf{fma}\left(y, \frac{z - 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 <= -3.1778304487720257e+37)) {
VAR = fma((y / (a - t)), (z - t), x);
} else {
double VAR_1;
if ((y <= 1.7883278228757425e-99)) {
VAR_1 = fma((1.0 / (a - t)), (y / (1.0 / (z - t))), x);
} else {
VAR_1 = fma(y, ((z - 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.5 |
|---|---|
| Target | 0.4 |
| Herbie | 1.0 |
if y < -3.1778304487720257e+37Initial program 0.6
Simplified0.6
rmApplied clear-num0.8
rmApplied fma-udef0.8
Simplified0.7
rmApplied associate-/r/3.0
Applied fma-def3.0
if -3.1778304487720257e+37 < y < 1.7883278228757425e-99Initial program 2.5
Simplified2.5
rmApplied clear-num2.5
rmApplied fma-udef2.5
Simplified2.1
rmApplied div-inv2.1
Applied *-un-lft-identity2.1
Applied times-frac0.3
Applied fma-def0.3
if 1.7883278228757425e-99 < y Initial program 0.7
Simplified0.7
Final simplification1.0
herbie shell --seed 2020105 +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)))))