x + \frac{y \cdot \left(z - x\right)}{t}\begin{array}{l}
\mathbf{if}\;t \le -800510684912870016:\\
\;\;\;\;x + \frac{y}{\frac{t}{z - x}}\\
\mathbf{elif}\;t \le 6.914397869719574 \cdot 10^{-218}:\\
\;\;\;\;x + \frac{y \cdot \left(z - x\right)}{t}\\
\mathbf{elif}\;t \le 2.2207595967095594 \cdot 10^{-126}:\\
\;\;\;\;x + \frac{y}{t} \cdot \left(z - x\right)\\
\mathbf{else}:\\
\;\;\;\;x + y \cdot \frac{z - x}{t}\\
\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 VAR;
if ((t <= -8.0051068491287e+17)) {
VAR = (x + (y / (t / (z - x))));
} else {
double VAR_1;
if ((t <= 6.914397869719574e-218)) {
VAR_1 = (x + ((y * (z - x)) / t));
} else {
double VAR_2;
if ((t <= 2.2207595967095594e-126)) {
VAR_2 = (x + ((y / t) * (z - x)));
} else {
VAR_2 = (x + (y * ((z - x) / t)));
}
VAR_1 = VAR_2;
}
VAR = VAR_1;
}
return VAR;
}




Bits error versus x




Bits error versus y




Bits error versus z




Bits error versus t
Results
| Original | 6.8 |
|---|---|
| Target | 2.1 |
| Herbie | 1.9 |
if t < -8.0051068491287e+17Initial program 9.8
rmApplied associate-/l*1.1
if -8.0051068491287e+17 < t < 6.914397869719574e-218Initial program 2.0
if 6.914397869719574e-218 < t < 2.2207595967095594e-126Initial program 2.3
rmApplied associate-/l*16.6
rmApplied associate-/r/3.8
if 2.2207595967095594e-126 < t Initial program 8.2
rmApplied *-un-lft-identity8.2
Applied times-frac2.2
Simplified2.2
Final simplification1.9
herbie shell --seed 2020106
(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)))