\frac{x \cdot \left(y + z\right)}{z}\begin{array}{l}
\mathbf{if}\;y \le -3.2437167390649342 \cdot 10^{138}:\\
\;\;\;\;\frac{y}{\frac{z}{x}} + x\\
\mathbf{elif}\;y \le 6.42201996887575028 \cdot 10^{193}:\\
\;\;\;\;\frac{x}{\frac{z}{y + z}}\\
\mathbf{elif}\;y \le 3.4762136697281315 \cdot 10^{266}:\\
\;\;\;\;\frac{y}{\frac{z}{x}} + 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 VAR;
if ((y <= -3.243716739064934e+138)) {
VAR = ((y / (z / x)) + x);
} else {
double VAR_1;
if ((y <= 6.42201996887575e+193)) {
VAR_1 = (x / (z / (y + z)));
} else {
double VAR_2;
if ((y <= 3.4762136697281315e+266)) {
VAR_2 = ((y / (z / x)) + x);
} else {
VAR_2 = (x * ((y + z) / z));
}
VAR_1 = VAR_2;
}
VAR = VAR_1;
}
return VAR;
}




Bits error versus x




Bits error versus y




Bits error versus z
Results
| Original | 12.4 |
|---|---|
| Target | 3.0 |
| Herbie | 2.5 |
if y < -3.243716739064934e+138 or 6.42201996887575e+193 < y < 3.4762136697281315e+266Initial program 12.2
Taylor expanded around 0 11.2
rmApplied *-commutative11.2
Applied associate-/l*7.3
if -3.243716739064934e+138 < y < 6.42201996887575e+193Initial program 12.4
rmApplied associate-/l*1.4
if 3.4762136697281315e+266 < y Initial program 16.9
rmApplied associate-/l*12.8
rmApplied div-inv13.8
Simplified13.7
Final simplification2.5
herbie shell --seed 2020078
(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))