x + y \cdot \frac{z - t}{a - t}\begin{array}{l}
\mathbf{if}\;y \cdot \frac{z - t}{a - t} \leq -\infty:\\
\;\;\;\;\frac{y \cdot z}{a - t}\\
\mathbf{elif}\;y \cdot \frac{z - t}{a - t} \leq 2.836526295028813 \cdot 10^{+287}:\\
\;\;\;\;y \cdot \frac{z - t}{a - t} + x\\
\mathbf{else}:\\
\;\;\;\;x + \frac{z - t}{\frac{a - t}{y}}\\
\end{array}(FPCore (x y z t a) :precision binary64 (+ x (* y (/ (- z t) (- a t)))))
(FPCore (x y z t a)
:precision binary64
(if (<= (* y (/ (- z t) (- a t))) (- INFINITY))
(/ (* y z) (- a t))
(if (<= (* y (/ (- z t) (- a t))) 2.836526295028813e+287)
(+ (* y (/ (- z t) (- a t))) x)
(+ x (/ (- z t) (/ (- a t) y))))))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 tmp;
if ((y * ((z - t) / (a - t))) <= -((double) INFINITY)) {
tmp = (y * z) / (a - t);
} else if ((y * ((z - t) / (a - t))) <= 2.836526295028813e+287) {
tmp = (y * ((z - t) / (a - t))) + x;
} else {
tmp = x + ((z - t) / ((a - t) / y));
}
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 | 0.5 |
| Herbie | 0.5 |
if (*.f64 y (/.f64 (-.f64 z t) (-.f64 a t))) < -inf.0Initial program 64.0
Taylor expanded around inf 16.8
if -inf.0 < (*.f64 y (/.f64 (-.f64 z t) (-.f64 a t))) < 2.8365262950288132e287Initial program 0.3
if 2.8365262950288132e287 < (*.f64 y (/.f64 (-.f64 z t) (-.f64 a t))) Initial program 23.7
Taylor expanded around 0 28.0
Simplified28.0
rmApplied associate-/l*_binary64_150273.5
Final simplification0.5
herbie shell --seed 2021098
(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)))))