x + \frac{y \cdot \left(z - t\right)}{a}
\begin{array}{l}
\mathbf{if}\;y \leq -1.681862728285677 \cdot 10^{+28}:\\
\;\;\;\;x + \frac{y}{\sqrt[3]{a} \cdot \sqrt[3]{a}} \cdot \frac{z - t}{\sqrt[3]{a}}\\
\mathbf{elif}\;y \leq 6.996154411165649 \cdot 10^{-88}:\\
\;\;\;\;x + \left(\frac{1}{\frac{a}{y \cdot z}} - \frac{y \cdot t}{a}\right)\\
\mathbf{else}:\\
\;\;\;\;x + \mathsf{fma}\left(y, \frac{z}{a}, -y \cdot \frac{t}{a}\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 -1.681862728285677e+28)
(+ x (* (/ y (* (cbrt a) (cbrt a))) (/ (- z t) (cbrt a))))
(if (<= y 6.996154411165649e-88)
(+ x (- (/ 1.0 (/ a (* y z))) (/ (* y t) a)))
(+ x (fma y (/ z a) (- (* y (/ t a))))))))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 <= -1.681862728285677e+28) {
tmp = x + ((y / (cbrt(a) * cbrt(a))) * ((z - t) / cbrt(a)));
} else if (y <= 6.996154411165649e-88) {
tmp = x + ((1.0 / (a / (y * z))) - ((y * t) / a));
} else {
tmp = x + fma(y, (z / a), -(y * (t / a)));
}
return tmp;
}




Bits error versus x




Bits error versus y




Bits error versus z




Bits error versus t




Bits error versus a
| Original | 5.9 |
|---|---|
| Target | 0.7 |
| Herbie | 1.3 |
if y < -1.681862728285677e28Initial program 17.4
Applied add-cube-cbrt_binary6417.9
Applied times-frac_binary642.7
if -1.681862728285677e28 < y < 6.9961544111656494e-88Initial program 0.6
Taylor expanded in z around 0 0.6
Applied clear-num_binary640.6
Simplified0.6
if 6.9961544111656494e-88 < y Initial program 9.9
Taylor expanded in z around 0 9.9
Applied *-un-lft-identity_binary649.9
Applied times-frac_binary646.7
Applied fma-neg_binary646.7
Simplified1.8
Final simplification1.3
herbie shell --seed 2022068
(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)))