x + \frac{y \cdot \left(z - x\right)}{t}\begin{array}{l}
\mathbf{if}\;t \leq -2.586633332464155 \cdot 10^{-162}:\\
\;\;\;\;x + \frac{y}{\frac{t}{z - x}}\\
\mathbf{else}:\\
\;\;\;\;x + \frac{\frac{y}{t}}{\frac{1}{z - x}}\\
\end{array}(FPCore (x y z t) :precision binary64 (+ x (/ (* y (- z x)) t)))
(FPCore (x y z t) :precision binary64 (if (<= t -2.586633332464155e-162) (+ x (/ y (/ t (- z x)))) (+ x (/ (/ y t) (/ 1.0 (- z x))))))
double code(double x, double y, double z, double t) {
return ((double) (x + (((double) (y * ((double) (z - x)))) / t)));
}
double code(double x, double y, double z, double t) {
double tmp;
if ((t <= -2.586633332464155e-162)) {
tmp = ((double) (x + (y / (t / ((double) (z - x))))));
} else {
tmp = ((double) (x + ((y / t) / (1.0 / ((double) (z - x))))));
}
return tmp;
}




Bits error versus x




Bits error versus y




Bits error versus z




Bits error versus t
Results
| Original | 6.4 |
|---|---|
| Target | 2.1 |
| Herbie | 2.8 |
if t < -2.586633332464155e-162Initial program Error: 6.8 bits
rmApplied associate-/l*Error: 3.0 bits
if -2.586633332464155e-162 < t Initial program Error: 6.1 bits
rmApplied associate-/l*Error: 8.1 bits
rmApplied div-invError: 8.2 bits
Applied associate-/r*Error: 2.7 bits
Final simplificationError: 2.8 bits
herbie shell --seed 2020204
(FPCore (x y z t)
:name "Optimisation.CirclePacking:place from circle-packing-0.1.0.4, D"
:precision binary64
:herbie-target
(- x (+ (* x (/ y t)) (* (- z) (/ y t))))
(+ x (/ (* y (- z x)) t)))