x + \frac{y \cdot \left(z - x\right)}{t}\begin{array}{l}
\mathbf{if}\;t \leq -3881122855271.2124:\\
\;\;\;\;x + \frac{y}{\frac{t}{z - x}}\\
\mathbf{elif}\;t \leq 6.722683654093909 \cdot 10^{-21}:\\
\;\;\;\;x + \left(y \cdot \left(z - x\right)\right) \cdot \frac{1}{t}\\
\mathbf{else}:\\
\;\;\;\;x + \left(z - x\right) \cdot \frac{y}{t}\\
\end{array}(FPCore (x y z t) :precision binary64 (+ x (/ (* y (- z x)) t)))
(FPCore (x y z t)
:precision binary64
(if (<= t -3881122855271.2124)
(+ x (/ y (/ t (- z x))))
(if (<= t 6.722683654093909e-21)
(+ x (* (* y (- z x)) (/ 1.0 t)))
(+ x (* (- z x) (/ y t))))))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 (t <= -3881122855271.2124) {
tmp = x + (y / (t / (z - x)));
} else if (t <= 6.722683654093909e-21) {
tmp = x + ((y * (z - x)) * (1.0 / t));
} else {
tmp = x + ((z - x) * (y / t));
}
return tmp;
}




Bits error versus x




Bits error versus y




Bits error versus z




Bits error versus t
Results
| Original | 6.3 |
|---|---|
| Target | 2.1 |
| Herbie | 1.2 |
if t < -3881122855271.2124Initial program 9.0
rmApplied associate-/l*_binary641.1
if -3881122855271.2124 < t < 6.72268365409390877e-21Initial program 1.7
rmApplied div-inv_binary641.7
if 6.72268365409390877e-21 < t Initial program 9.0
rmApplied associate-/l*_binary641.1
rmApplied associate-/r/_binary640.7
Final simplification1.2
herbie shell --seed 2020233
(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)))