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




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 | 1.2 |
| Herbie | 1.6 |
if y < -4.32134167410994419e118Initial program 0.7
if -4.32134167410994419e118 < y < 2.7346412179090334e-118Initial program 1.9
rmApplied div-inv_binary641.9
Applied associate-*r*_binary642.3
if 2.7346412179090334e-118 < y Initial program 0.8
rmApplied clear-num_binary640.9
rmApplied un-div-inv_binary640.7
Final simplification1.6
herbie shell --seed 2020260
(FPCore (x y z t a)
:name "Graphics.Rendering.Plot.Render.Plot.Axis:renderAxisLine from plot-0.2.3.4, A"
:precision binary64
:herbie-target
(+ x (/ y (/ (- z a) (- z t))))
(+ x (* y (/ (- z t) (- z a)))))