x + \frac{y \cdot \left(z - t\right)}{a}\begin{array}{l}
\mathbf{if}\;y \cdot \left(z - t\right) \leq -2.961337850366166 \cdot 10^{+222}:\\
\;\;\;\;x + \left(z - t\right) \cdot \frac{y}{a}\\
\mathbf{elif}\;y \cdot \left(z - t\right) \leq 1.2914759979061437 \cdot 10^{+248}:\\
\;\;\;\;x + \left(y \cdot \left(z - t\right)\right) \cdot \frac{1}{a}\\
\mathbf{else}:\\
\;\;\;\;x + y \cdot \left(\frac{z}{a} - \frac{t}{a}\right)\\
\end{array}double code(double x, double y, double z, double t, double a) {
return ((double) (x + (((double) (y * ((double) (z - t)))) / a)));
}
double code(double x, double y, double z, double t, double a) {
double VAR;
if ((((double) (y * ((double) (z - t)))) <= -2.961337850366166e+222)) {
VAR = ((double) (x + ((double) (((double) (z - t)) * (y / a)))));
} else {
double VAR_1;
if ((((double) (y * ((double) (z - t)))) <= 1.2914759979061437e+248)) {
VAR_1 = ((double) (x + ((double) (((double) (y * ((double) (z - t)))) * (1.0 / a)))));
} else {
VAR_1 = ((double) (x + ((double) (y * ((double) ((z / a) - (t / a)))))));
}
VAR = VAR_1;
}
return VAR;
}




Bits error versus x




Bits error versus y




Bits error versus z




Bits error versus t




Bits error versus a
Results
| Original | 6.5 |
|---|---|
| Target | 0.8 |
| Herbie | 0.5 |
if (* y (- z t)) < -2.96133785036616623e222Initial program 33.3
Simplified0.5
rmApplied div-sub0.5
rmApplied div-inv0.5
Applied div-inv0.6
Applied distribute-rgt-out--0.6
Applied associate-*r*0.5
Simplified0.4
if -2.96133785036616623e222 < (* y (- z t)) < 1.29147599790614367e248Initial program 0.5
Simplified7.0
rmApplied div-inv7.0
Applied associate-*r*0.5
if 1.29147599790614367e248 < (* y (- z t)) Initial program 39.5
Simplified0.4
rmApplied div-sub0.4
Final simplification0.5
herbie shell --seed 2020196
(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)))