x + \frac{y \cdot \left(z - x\right)}{t}\begin{array}{l}
\mathbf{if}\;t \le -8.7531850924869805 \cdot 10^{-259}:\\
\;\;\;\;\mathsf{fma}\left(\frac{y}{t}, z - x, x\right)\\
\mathbf{elif}\;t \le 59621164056.8936081:\\
\;\;\;\;x + \frac{y \cdot \left(z - x\right)}{t}\\
\mathbf{else}:\\
\;\;\;\;\mathsf{fma}\left(\frac{z}{t}, y, x\right) - \frac{x}{\frac{t}{y}}\\
\end{array}double code(double x, double y, double z, double t) {
return ((double) (x + ((double) (((double) (y * ((double) (z - x)))) / t))));
}
double code(double x, double y, double z, double t) {
double VAR;
if ((t <= -8.75318509248698e-259)) {
VAR = ((double) fma(((double) (y / t)), ((double) (z - x)), x));
} else {
double VAR_1;
if ((t <= 59621164056.89361)) {
VAR_1 = ((double) (x + ((double) (((double) (y * ((double) (z - x)))) / t))));
} else {
VAR_1 = ((double) (((double) fma(((double) (z / t)), y, x)) - ((double) (x / ((double) (t / y))))));
}
VAR = VAR_1;
}
return VAR;
}




Bits error versus x




Bits error versus y




Bits error versus z




Bits error versus t
Results
| Original | 6.5 |
|---|---|
| Target | 1.9 |
| Herbie | 1.5 |
if t < -8.75318509248698e-259Initial program 6.4
Simplified1.7
if -8.75318509248698e-259 < t < 59621164056.89361Initial program 2.1
if 59621164056.89361 < t Initial program 10.0
rmApplied *-commutative10.0
Applied associate-/l*1.2
rmApplied div-sub1.2
Applied associate-+r-1.2
Simplified0.8
Final simplification1.5
herbie shell --seed 2020114 +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)))