x + \frac{y \cdot \left(z - x\right)}{t}\begin{array}{l}
\mathbf{if}\;t \le -8.04065500205821708 \cdot 10^{99}:\\
\;\;\;\;\mathsf{fma}\left(\frac{z - x}{t}, y, x\right)\\
\mathbf{elif}\;t \le 5.3464729145636056 \cdot 10^{-37}:\\
\;\;\;\;\frac{y \cdot \left(z - x\right)}{t} + x\\
\mathbf{else}:\\
\;\;\;\;\frac{z - x}{\frac{t}{y}} + 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 VAR;
if ((t <= -8.040655002058217e+99)) {
VAR = fma(((z - x) / t), y, x);
} else {
double VAR_1;
if ((t <= 5.3464729145636056e-37)) {
VAR_1 = (((y * (z - x)) / t) + x);
} else {
VAR_1 = (((z - x) / (t / y)) + x);
}
VAR = VAR_1;
}
return VAR;
}




Bits error versus x




Bits error versus y




Bits error versus z




Bits error versus t
Results
| Original | 6.6 |
|---|---|
| Target | 2.0 |
| Herbie | 1.6 |
if t < -8.040655002058217e+99Initial program 11.8
Simplified1.0
rmApplied fma-udef1.0
rmApplied clear-num1.1
Applied associate-*l/1.0
Simplified1.0
rmApplied associate-/r/1.3
Applied fma-def1.3
if -8.040655002058217e+99 < t < 5.3464729145636056e-37Initial program 2.2
Simplified3.2
rmApplied fma-udef3.2
rmApplied associate-*l/2.2
if 5.3464729145636056e-37 < t Initial program 8.6
Simplified1.1
rmApplied fma-udef1.1
rmApplied clear-num1.2
Applied associate-*l/1.2
Simplified1.2
Final simplification1.6
herbie shell --seed 2020071 +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)))