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




Bits error versus x




Bits error versus y




Bits error versus z




Bits error versus t
Results
| Original | 6.9 |
|---|---|
| Target | 2.0 |
| Herbie | 2.1 |
if x < 2.24921530832656348e-306Initial program 6.9
rmApplied associate-/l*_binary646.3
rmApplied div-inv_binary646.4
Applied associate-/r*_binary642.0
if 2.24921530832656348e-306 < x < 5.7385942161409859e-14Initial program 4.2
if 5.7385942161409859e-14 < x Initial program 9.6
rmApplied associate-/l*_binary647.6
rmApplied associate-/r/_binary640.1
Final simplification2.1
herbie shell --seed 2020224
(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)))