x + \frac{y \cdot \left(z - t\right)}{a - t}
\begin{array}{l}
t_1 := \frac{y \cdot \left(z - t\right)}{a - t}\\
\mathbf{if}\;t_1 \leq -\infty:\\
\;\;\;\;\begin{array}{l}
t_2 := \frac{y}{a - t}\\
x + \left(z \cdot t_2 - t \cdot t_2\right)
\end{array}\\
\mathbf{elif}\;t_1 \leq 1.636389978005464 \cdot 10^{-106}:\\
\;\;\;\;t_1 + x\\
\mathbf{else}:\\
\;\;\;\;x + \frac{y}{\frac{a - t}{z - t}}\\
\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 (/ (* y (- z t)) (- a t))))
(if (<= t_1 (- INFINITY))
(let* ((t_2 (/ y (- a t)))) (+ x (- (* z t_2) (* t t_2))))
(if (<= t_1 1.636389978005464e-106)
(+ t_1 x)
(+ x (/ y (/ (- a t) (- z t))))))))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 = (y * (z - t)) / (a - t);
double tmp;
if (t_1 <= -((double) INFINITY)) {
double t_2_1 = y / (a - t);
tmp = x + ((z * t_2_1) - (t * t_2_1));
} else if (t_1 <= 1.636389978005464e-106) {
tmp = t_1 + x;
} else {
tmp = x + (y / ((a - t) / (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 | 10.5 |
|---|---|
| Target | 1.2 |
| Herbie | 0.7 |
if (/.f64 (*.f64 y (-.f64 z t)) (-.f64 a t)) < -inf.0Initial program 64.0
Simplified0.1
Taylor expanded in y around 0 64.0
Simplified0.2
Applied sub-neg_binary640.2
Applied distribute-rgt-in_binary640.2
if -inf.0 < (/.f64 (*.f64 y (-.f64 z t)) (-.f64 a t)) < 1.6363899780054641e-106Initial program 0.3
if 1.6363899780054641e-106 < (/.f64 (*.f64 y (-.f64 z t)) (-.f64 a t)) Initial program 17.3
Applied associate-/l*_binary641.6
Final simplification0.7
herbie shell --seed 2021340
(FPCore (x y z t a)
:name "Graphics.Rendering.Plot.Render.Plot.Axis:renderAxisTicks from plot-0.2.3.4, B"
:precision binary64
:herbie-target
(+ x (/ y (/ (- a t) (- z t))))
(+ x (/ (* y (- z t)) (- a t))))