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




Bits error versus x




Bits error versus y




Bits error versus z




Bits error versus t




Bits error versus a
Results
| Original | 6.2 |
|---|---|
| Target | 0.7 |
| Herbie | 1.9 |
if (*.f64 y (-.f64 z t)) < -1.0891107148063213e162Initial program 22.5
rmApplied clear-num_binary6422.5
Simplified22.5
rmApplied *-un-lft-identity_binary6422.5
Applied times-frac_binary641.5
Applied add-cube-cbrt_binary641.5
Applied times-frac_binary641.6
Simplified1.5
Simplified1.4
if -1.0891107148063213e162 < (*.f64 y (-.f64 z t)) < -3.91463074575321983e-215Initial program 0.1
rmApplied clear-num_binary640.2
Simplified0.2
Taylor expanded around inf 0.2
if -3.91463074575321983e-215 < (*.f64 y (-.f64 z t)) Initial program 5.7
rmApplied add-cube-cbrt_binary646.1
Applied associate-/r*_binary646.1
Simplified2.9
Final simplification1.9
herbie shell --seed 2021175
(FPCore (x y z t a)
:name "Optimisation.CirclePacking:place from circle-packing-0.1.0.4, F"
: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)))