x - \frac{y \cdot \left(z - t\right)}{a}\begin{array}{l}
\mathbf{if}\;y \cdot \left(z - t\right) \leq -2.7144402286755834 \cdot 10^{+130}:\\
\;\;\;\;x + \frac{y}{a} \cdot \left(t - z\right)\\
\mathbf{elif}\;y \cdot \left(z - t\right) \leq 2.2509373205922187 \cdot 10^{+181}:\\
\;\;\;\;x - \frac{1}{\frac{a}{y \cdot \left(z - t\right)}}\\
\mathbf{else}:\\
\;\;\;\;x - y \cdot \frac{z - t}{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)) -2.7144402286755834e+130)
(+ x (* (/ y a) (- t z)))
(if (<= (* y (- z t)) 2.2509373205922187e+181)
(- x (/ 1.0 (/ a (* y (- z t)))))
(- x (* y (/ (- z 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 * (z - t)) <= -2.7144402286755834e+130) {
tmp = x + ((y / a) * (t - z));
} else if ((y * (z - t)) <= 2.2509373205922187e+181) {
tmp = x - (1.0 / (a / (y * (z - t))));
} else {
tmp = x - (y * ((z - t) / 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.0 |
|---|---|
| Target | 0.8 |
| Herbie | 0.8 |
if (*.f64 y (-.f64 z t)) < -2.71444022867558344e130Initial program 20.2
rmApplied sub-neg_binary64_984320.2
Simplified1.5
if -2.71444022867558344e130 < (*.f64 y (-.f64 z t)) < 2.250937320592219e181Initial program 0.5
rmApplied clear-num_binary64_98490.5
if 2.250937320592219e181 < (*.f64 y (-.f64 z t)) Initial program 23.2
rmApplied *-un-lft-identity_binary64_985023.2
Applied times-frac_binary64_98561.7
Simplified1.7
Final simplification0.8
herbie shell --seed 2020281
(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)))