x + y \cdot \frac{z - t}{z - a}
\begin{array}{l}
t_1 := x + y \cdot \frac{z - t}{z - a}\\
\mathbf{if}\;y \leq -7.515725844238207 \cdot 10^{-85}:\\
\;\;\;\;t_1\\
\mathbf{elif}\;y \leq 2.717196829604943 \cdot 10^{-16}:\\
\;\;\;\;\left(x + \frac{y \cdot z}{z - a}\right) - \frac{y \cdot t}{z - a}\\
\mathbf{else}:\\
\;\;\;\;t_1\\
\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 (+ x (* y (/ (- z t) (- z a))))))
(if (<= y -7.515725844238207e-85)
t_1
(if (<= y 2.717196829604943e-16)
(- (+ x (/ (* y z) (- z a))) (/ (* y t) (- z a)))
t_1))))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 = x + (y * ((z - t) / (z - a)));
double tmp;
if (y <= -7.515725844238207e-85) {
tmp = t_1;
} else if (y <= 2.717196829604943e-16) {
tmp = (x + ((y * z) / (z - a))) - ((y * t) / (z - a));
} else {
tmp = t_1;
}
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.3 |
|---|---|
| Target | 1.3 |
| Herbie | 0.4 |
if y < -7.51572584423820702e-85 or 2.71719682960494313e-16 < y Initial program 0.6
if -7.51572584423820702e-85 < y < 2.71719682960494313e-16Initial program 2.3
Simplified2.3
Taylor expanded in y around 0 0.3
Final simplification0.4
herbie shell --seed 2022076
(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)))))