\frac{x \cdot \left(y + z\right)}{z}\begin{array}{l}
\mathbf{if}\;z \le 1.6319585875966188 \cdot 10^{-267}:\\
\;\;\;\;\frac{x}{\frac{z}{y + z}}\\
\mathbf{elif}\;z \le 7.99744230430140596 \cdot 10^{-211}:\\
\;\;\;\;\frac{x \cdot y}{z} + x\\
\mathbf{else}:\\
\;\;\;\;x \cdot \frac{y + z}{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 temp;
if ((z <= 1.6319585875966188e-267)) {
temp = (x / (z / (y + z)));
} else {
double temp_1;
if ((z <= 7.997442304301406e-211)) {
temp_1 = (((x * y) / z) + x);
} else {
temp_1 = (x * ((y + z) / z));
}
temp = temp_1;
}
return temp;
}




Bits error versus x




Bits error versus y




Bits error versus z
Results
| Original | 12.4 |
|---|---|
| Target | 3.2 |
| Herbie | 3.1 |
if z < 1.6319585875966188e-267Initial program 12.3
rmApplied associate-/l*3.5
if 1.6319585875966188e-267 < z < 7.997442304301406e-211Initial program 11.5
Taylor expanded around 0 7.8
if 7.997442304301406e-211 < z Initial program 12.6
rmApplied *-un-lft-identity12.6
Applied times-frac2.2
Simplified2.2
Final simplification3.1
herbie shell --seed 2020053
(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))