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 -2.7868805564807467 \cdot 10^{+284}:\\
\;\;\;\;\mathsf{fma}\left(y, \frac{z - t}{a - t}, x\right)\\
\mathbf{elif}\;t_1 \leq 1.5653093214390899 \cdot 10^{+184}:\\
\;\;\;\;\left(x + \frac{y \cdot z}{a - t}\right) - \frac{y \cdot t}{a - t}\\
\mathbf{else}:\\
\;\;\;\;x + \left(z - t\right) \cdot \frac{y}{a - 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 -2.7868805564807467e+284)
(fma y (/ (- z t) (- a t)) x)
(if (<= t_1 1.5653093214390899e+184)
(- (+ x (/ (* y z) (- a t))) (/ (* y t) (- a t)))
(+ x (* (- z t) (/ y (- a 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 <= -2.7868805564807467e+284) {
tmp = fma(y, ((z - t) / (a - t)), x);
} else if (t_1 <= 1.5653093214390899e+184) {
tmp = (x + ((y * z) / (a - t))) - ((y * t) / (a - t));
} else {
tmp = x + ((z - t) * (y / (a - t)));
}
return tmp;
}




Bits error versus x




Bits error versus y




Bits error versus z




Bits error versus t




Bits error versus a
| Original | 9.3 |
|---|---|
| Target | 1.1 |
| Herbie | 0.6 |
if (/.f64 (*.f64 y (-.f64 z t)) (-.f64 a t)) < -2.786880556480747e284Initial program 36.2
Simplified0.3
if -2.786880556480747e284 < (/.f64 (*.f64 y (-.f64 z t)) (-.f64 a t)) < 1.5653093214390899e184Initial program 0.3
Simplified1.3
Taylor expanded in y around 0 0.3
if 1.5653093214390899e184 < (/.f64 (*.f64 y (-.f64 z t)) (-.f64 a t)) Initial program 32.0
Simplified1.5
Taylor expanded in y around 0 33.0
Simplified2.4
Final simplification0.6
herbie shell --seed 2022088
(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))))