\frac{x \cdot \left(y + z\right)}{z}\begin{array}{l}
\mathbf{if}\;y \le -1.7672276150092905 \cdot 10^{236}:\\
\;\;\;\;\frac{x \cdot y}{z} + x\\
\mathbf{elif}\;y \le 9.8124351507309985 \cdot 10^{-21}:\\
\;\;\;\;\frac{x}{\frac{z}{y + z}}\\
\mathbf{elif}\;y \le 1.95805875046091314 \cdot 10^{211}:\\
\;\;\;\;\frac{1}{\frac{\frac{z}{x}}{y}} + x\\
\mathbf{else}:\\
\;\;\;\;\frac{x \cdot y}{z} + x\\
\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 ((y <= -1.7672276150092905e+236)) {
temp = (((x * y) / z) + x);
} else {
double temp_1;
if ((y <= 9.812435150730998e-21)) {
temp_1 = (x / (z / (y + z)));
} else {
double temp_2;
if ((y <= 1.9580587504609131e+211)) {
temp_2 = ((1.0 / ((z / x) / y)) + x);
} else {
temp_2 = (((x * y) / z) + x);
}
temp_1 = temp_2;
}
temp = temp_1;
}
return temp;
}




Bits error versus x




Bits error versus y




Bits error versus z
Results
| Original | 12.1 |
|---|---|
| Target | 3.2 |
| Herbie | 2.7 |
if y < -1.7672276150092905e+236 or 1.9580587504609131e+211 < y Initial program 13.4
Taylor expanded around 0 12.9
if -1.7672276150092905e+236 < y < 9.812435150730998e-21Initial program 12.4
rmApplied associate-/l*1.4
if 9.812435150730998e-21 < y < 1.9580587504609131e+211Initial program 9.9
Taylor expanded around 0 4.4
rmApplied clear-num4.5
rmApplied associate-/r*2.3
Final simplification2.7
herbie shell --seed 2020058
(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))