x + \frac{y \cdot \left(z - t\right)}{a}
\begin{array}{l}
\mathbf{if}\;y \leq -8.821147173561544 \cdot 10^{+21}:\\
\;\;\;\;\mathsf{fma}\left(y, \frac{z - t}{a}, x\right)\\
\mathbf{elif}\;y \leq 4.361135130640675 \cdot 10^{-57}:\\
\;\;\;\;\left(x + \frac{y \cdot z}{a}\right) - \frac{y \cdot t}{a}\\
\mathbf{else}:\\
\;\;\;\;\mathsf{fma}\left(y, \left(z - t\right) \cdot \frac{1}{a}, x\right)\\
\end{array}
(FPCore (x y z t a) :precision binary64 (+ x (/ (* y (- z t)) a)))
(FPCore (x y z t a)
:precision binary64
(if (<= y -8.821147173561544e+21)
(fma y (/ (- z t) a) x)
(if (<= y 4.361135130640675e-57)
(- (+ x (/ (* y z) a)) (/ (* y t) a))
(fma y (* (- z t) (/ 1.0 a)) x))))double code(double x, double y, double z, double t, double a) {
return x + ((y * (z - t)) / a);
}
double code(double x, double y, double z, double t, double a) {
double tmp;
if (y <= -8.821147173561544e+21) {
tmp = fma(y, ((z - t) / a), x);
} else if (y <= 4.361135130640675e-57) {
tmp = (x + ((y * z) / a)) - ((y * t) / a);
} else {
tmp = fma(y, ((z - t) * (1.0 / a)), x);
}
return tmp;
}




Bits error versus x




Bits error versus y




Bits error versus z




Bits error versus t




Bits error versus a
| Original | 6.1 |
|---|---|
| Target | 0.7 |
| Herbie | 0.8 |
if y < -8.8211471735615442e21Initial program 17.9
Simplified0.8
if -8.8211471735615442e21 < y < 4.3611351306406748e-57Initial program 0.5
Simplified9.2
Taylor expanded in y around 0 0.5
if 4.3611351306406748e-57 < y Initial program 11.1
Simplified1.2
Applied div-inv_binary641.3
Final simplification0.8
herbie shell --seed 2022125
(FPCore (x y z t a)
:name "Optimisation.CirclePacking:place from circle-packing-0.1.0.4, E"
:precision binary64
:herbie-target
(if (< y -1.0761266216389975e-10) (+ x (/ 1.0 (/ (/ a (- z t)) y))) (if (< y 2.894426862792089e-49) (+ x (/ (* y (- z t)) a)) (+ x (/ y (/ a (- z t))))))
(+ x (/ (* y (- z t)) a)))