\frac{x \cdot \left(y + z\right)}{z}\begin{array}{l}
\mathbf{if}\;z \le -6.90740619564049756 \cdot 10^{-60}:\\
\;\;\;\;\mathsf{fma}\left(\frac{y}{z}, x, x\right)\\
\mathbf{elif}\;z \le 1.62589878773930302 \cdot 10^{-80}:\\
\;\;\;\;\frac{x \cdot \left(y + z\right)}{z}\\
\mathbf{else}:\\
\;\;\;\;\frac{x}{\frac{z}{y + z}}\\
\end{array}double code(double x, double y, double z) {
return ((x * (y + z)) / z);
}
double code(double x, double y, double z) {
double VAR;
if ((z <= -6.907406195640498e-60)) {
VAR = fma((y / z), x, x);
} else {
double VAR_1;
if ((z <= 1.625898787739303e-80)) {
VAR_1 = ((x * (y + z)) / z);
} else {
VAR_1 = (x / (z / (y + z)));
}
VAR = VAR_1;
}
return VAR;
}




Bits error versus x




Bits error versus y




Bits error versus z
Results
| Original | 12.4 |
|---|---|
| Target | 2.9 |
| Herbie | 2.6 |
if z < -6.907406195640498e-60Initial program 14.6
Simplified0.5
if -6.907406195640498e-60 < z < 1.625898787739303e-80Initial program 7.7
if 1.625898787739303e-80 < z Initial program 14.1
rmApplied associate-/l*0.3
Final simplification2.6
herbie shell --seed 2020105 +o rules:numerics
(FPCore (x y z)
:name "Numeric.SpecFunctions:choose from math-functions-0.1.5.2"
:precision binary64
:herbie-target
(/ x (/ z (+ y z)))
(/ (* x (+ y z)) z))