x + y \cdot \frac{z - t}{z - a}\begin{array}{l}
\mathbf{if}\;y \leq -2.1742114105338213 \cdot 10^{-25}:\\
\;\;\;\;x + y \cdot \left(\frac{z}{z - a} - \frac{t}{z - a}\right)\\
\mathbf{elif}\;y \leq 4.6416593455394884 \cdot 10^{+64}:\\
\;\;\;\;x + \left(\frac{y \cdot z}{z - a} - \frac{y \cdot t}{z - a}\right)\\
\mathbf{else}:\\
\;\;\;\;x + y \cdot \frac{1}{\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 -2.1742114105338213e-25)
(+ x (* y (- (/ z (- z a)) (/ t (- z a)))))
(if (<= y 4.6416593455394884e+64)
(+ x (- (/ (* y z) (- z a)) (/ (* y t) (- z a))))
(+ x (* y (/ 1.0 (/ (- 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 <= -2.1742114105338213e-25) {
tmp = x + (y * ((z / (z - a)) - (t / (z - a))));
} else if (y <= 4.6416593455394884e+64) {
tmp = x + (((y * z) / (z - a)) - ((y * t) / (z - a)));
} else {
tmp = x + (y * (1.0 / ((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.3 |
| Herbie | 0.7 |
if y < -2.1742114105338213e-25Initial program 0.5
rmApplied div-sub_binary64_127000.5
if -2.1742114105338213e-25 < y < 4.6416593455394884e64Initial program 2.1
Taylor expanded around 0 0.8
if 4.6416593455394884e64 < y Initial program 0.6
rmApplied clear-num_binary64_126940.7
Final simplification0.7
herbie shell --seed 2021022
(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)))))