x + \frac{y \cdot \left(z - x\right)}{t}\begin{array}{l}
\mathbf{if}\;x \le -4.5398872775483471 \cdot 10^{-26} \lor \neg \left(x \le 4.1248528858694328 \cdot 10^{-151}\right):\\
\;\;\;\;\frac{y}{t} \cdot \left(z - x\right) + x\\
\mathbf{else}:\\
\;\;\;\;\frac{y}{\frac{t}{z - x}} + x\\
\end{array}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 temp;
if (((x <= -4.539887277548347e-26) || !(x <= 4.124852885869433e-151))) {
temp = (((y / t) * (z - x)) + x);
} else {
temp = ((y / (t / (z - x))) + x);
}
return temp;
}




Bits error versus x




Bits error versus y




Bits error versus z




Bits error versus t
Results
| Original | 6.6 |
|---|---|
| Target | 2.4 |
| Herbie | 2.2 |
if x < -4.539887277548347e-26 or 4.124852885869433e-151 < x Initial program 7.6
Simplified0.5
rmApplied fma-udef0.5
if -4.539887277548347e-26 < x < 4.124852885869433e-151Initial program 5.0
Simplified5.3
rmApplied fma-udef5.3
rmApplied associate-*l/5.0
rmApplied associate-/l*4.7
Final simplification2.2
herbie shell --seed 2020058 +o rules:numerics
(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)))