x + y \cdot \frac{z - t}{a - t}
\begin{array}{l}
\mathbf{if}\;y \leq -8.181875273801221 \cdot 10^{+64}:\\
\;\;\;\;\mathsf{fma}\left(y, \frac{1}{\frac{a - t}{z}} - \frac{t}{a - t}, x\right)\\
\mathbf{elif}\;y \leq 3.208986056831293 \cdot 10^{-122}:\\
\;\;\;\;x + \frac{y \cdot \left(z - t\right)}{a - t}\\
\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 (<= y -8.181875273801221e+64)
(fma y (- (/ 1.0 (/ (- a t) z)) (/ t (- a t))) x)
(if (<= y 3.208986056831293e-122)
(+ x (/ (* y (- z t)) (- a t)))
(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 (y <= -8.181875273801221e+64) {
tmp = fma(y, ((1.0 / ((a - t) / z)) - (t / (a - t))), x);
} else if (y <= 3.208986056831293e-122) {
tmp = x + ((y * (z - t)) / (a - t));
} 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.4 |
|---|---|
| Target | 0.5 |
| Herbie | 0.9 |
if y < -8.1818752738012213e64Initial program 0.9
Simplified0.9
Taylor expanded in z around 0 0.9
Applied clear-num_binary641.1
if -8.1818752738012213e64 < y < 3.208986056831293e-122Initial program 2.0
Taylor expanded in y around 0 0.9
if 3.208986056831293e-122 < y Initial program 0.8
Simplified0.8
Applied *-un-lft-identity_binary640.8
Applied associate-/r*_binary640.8
Final simplification0.9
herbie shell --seed 2022068
(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)))))