x + \frac{y \cdot \left(z - t\right)}{a}\begin{array}{l}
\mathbf{if}\;y \leq 4.892833980010369 \cdot 10^{-60}:\\
\;\;\;\;x + \frac{y}{a} \cdot \left(z - t\right)\\
\mathbf{else}:\\
\;\;\;\;x + \left(y \cdot \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 4.892833980010369e-60) (+ x (* (/ y a) (- z t))) (+ x (- (* y (/ z a)) (* y (/ t a))))))
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 ((y <= 4.892833980010369e-60)) {
VAR = ((double) (x + ((double) ((y / a) * ((double) (z - t))))));
} else {
VAR = ((double) (x + ((double) (((double) (y * (z / a))) - ((double) (y * (t / a)))))));
}
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.4 |
|---|---|
| Target | 0.8 |
| Herbie | 1.9 |
if y < 4.89283398001036916e-60Initial program 4.5
rmApplied clear-num4.5
rmApplied associate-/r*2.2
rmApplied div-inv2.3
Applied add-sqr-sqrt2.3
Applied times-frac2.3
Simplified2.2
Simplified2.2
if 4.89283398001036916e-60 < y Initial program 12.0
rmApplied clear-num12.0
rmApplied associate-/r*2.5
rmApplied div-inv2.5
Applied add-sqr-sqrt2.5
Applied times-frac2.8
Simplified2.7
Simplified2.7
rmApplied sub-neg2.7
Applied distribute-lft-in2.7
Simplified3.0
Simplified1.0
Final simplification1.9
herbie shell --seed 2020198
(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)))