x + \frac{y \cdot \left(z - t\right)}{a}\begin{array}{l}
\mathbf{if}\;y \cdot \left(z - t\right) \leq -4.186572604644466 \cdot 10^{+213}:\\
\;\;\;\;x + y \cdot \frac{z - t}{a}\\
\mathbf{elif}\;y \cdot \left(z - t\right) \leq 6.924752434527883 \cdot 10^{+165}:\\
\;\;\;\;x + \left(y \cdot \left(z - t\right)\right) \cdot \frac{1}{a}\\
\mathbf{else}:\\
\;\;\;\;x + \frac{y}{\frac{a}{z - t}}\\
\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)) -4.186572604644466e+213)
(+ x (* y (/ (- z t) a)))
(if (<= (* y (- z t)) 6.924752434527883e+165)
(+ x (* (* y (- z t)) (/ 1.0 a)))
(+ x (/ y (/ a (- z t)))))))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 tmp;
if ((((double) (y * ((double) (z - t)))) <= -4.186572604644466e+213)) {
tmp = ((double) (x + ((double) (y * (((double) (z - t)) / a)))));
} else {
double tmp_1;
if ((((double) (y * ((double) (z - t)))) <= 6.924752434527883e+165)) {
tmp_1 = ((double) (x + ((double) (((double) (y * ((double) (z - t)))) * (1.0 / a)))));
} else {
tmp_1 = ((double) (x + (y / (a / ((double) (z - t))))));
}
tmp = tmp_1;
}
return tmp;
}




Bits error versus x




Bits error versus y




Bits error versus z




Bits error versus t




Bits error versus a
Results
| Original | 5.8 |
|---|---|
| Target | 0.7 |
| Herbie | 0.6 |
if (* y (- z t)) < -4.1865726046444662e213Initial program Error: 29.9 bits
SimplifiedError: 0.8 bits
if -4.1865726046444662e213 < (* y (- z t)) < 6.9247524345278829e165Initial program Error: 0.4 bits
rmApplied div-invError: 0.5 bits
if 6.9247524345278829e165 < (* y (- z t)) Initial program Error: 21.3 bits
rmApplied associate-/l*Error: 1.6 bits
Final simplificationError: 0.6 bits
herbie shell --seed 2020204
(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)))