x + y \cdot \frac{z - t}{a - t}
\begin{array}{l}
\mathbf{if}\;z \leq -1.2741771487626443 \cdot 10^{+52}:\\
\;\;\;\;\mathsf{fma}\left(z - t, \frac{y}{a - t}, x\right)\\
\mathbf{else}:\\
\;\;\;\;\mathsf{fma}\left(y, \frac{z - t}{a - t}, x\right)\\
\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 (<= z -1.2741771487626443e+52) (fma (- z t) (/ y (- a t)) x) (fma y (/ (- z t) (- a t)) x)))
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 (z <= -1.2741771487626443e+52) {
tmp = fma((z - t), (y / (a - t)), x);
} else {
tmp = fma(y, ((z - t) / (a - t)), 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.2 |
|---|---|
| Target | 0.4 |
| Herbie | 1.1 |
if z < -1.2741771487626443e52Initial program 2.5
Simplified2.5
Taylor expanded in y around 0 12.4
Simplified2.1
Taylor expanded in x around 0 12.4
Simplified2.1
if -1.2741771487626443e52 < z Initial program 0.9
Simplified0.9
Final simplification1.1
herbie shell --seed 2022088
(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)))))