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




Bits error versus x




Bits error versus y




Bits error versus z




Bits error versus t




Bits error versus a
| Original | 1.4 |
|---|---|
| Target | 0.4 |
| Herbie | 0.4 |
if y < -3.69415349567001088e-41Initial program 0.5
Simplified0.5
if -3.69415349567001088e-41 < y < 0.00988990466152313806Initial program 2.3
Taylor expanded in y around 0 0.3
if 0.00988990466152313806 < y Initial program 0.6
Final simplification0.4
herbie shell --seed 2022097
(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.0 (- a t)))) (+ x (* y (/ (- z t) (- a t))))))
(+ x (* y (/ (- z t) (- a t)))))