x + y \cdot \frac{z - t}{z - a}
\begin{array}{l}
t_1 := \frac{z - t}{z - a}\\
\mathbf{if}\;y \leq -9.042638636563712 \cdot 10^{+45}:\\
\;\;\;\;x + y \cdot t_1\\
\mathbf{elif}\;y \leq 9.715510485428454 \cdot 10^{-48}:\\
\;\;\;\;x + \frac{y \cdot \left(z - t\right)}{z - a}\\
\mathbf{else}:\\
\;\;\;\;\mathsf{fma}\left(t_1, y, x\right)\\
\end{array}
(FPCore (x y z t a) :precision binary64 (+ x (* y (/ (- z t) (- z a)))))
(FPCore (x y z t a)
:precision binary64
(let* ((t_1 (/ (- z t) (- z a))))
(if (<= y -9.042638636563712e+45)
(+ x (* y t_1))
(if (<= y 9.715510485428454e-48)
(+ x (/ (* y (- z t)) (- z a)))
(fma t_1 y x)))))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 t_1 = (z - t) / (z - a);
double tmp;
if (y <= -9.042638636563712e+45) {
tmp = x + (y * t_1);
} else if (y <= 9.715510485428454e-48) {
tmp = x + ((y * (z - t)) / (z - a));
} else {
tmp = fma(t_1, y, x);
}
return tmp;
}




Bits error versus x




Bits error versus y




Bits error versus z




Bits error versus t




Bits error versus a
| Original | 1.5 |
|---|---|
| Target | 1.4 |
| Herbie | 0.6 |
if y < -9.0426386365637122e45Initial program 0.8
if -9.0426386365637122e45 < y < 9.7155104854284541e-48Initial program 2.3
Taylor expanded in y around 0 0.5
if 9.7155104854284541e-48 < y Initial program 0.5
Taylor expanded in y around 0 20.3
Taylor expanded in x around 0 20.3
Simplified0.6
Final simplification0.6
herbie shell --seed 2021340
(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)))))