\frac{x \cdot \left(y + z\right)}{z}\begin{array}{l}
\mathbf{if}\;z \le -3.368950694637007 \cdot 10^{-262} \lor \neg \left(z \le 1.47174836325826194 \cdot 10^{-149}\right):\\
\;\;\;\;x \cdot \frac{y + z}{z}\\
\mathbf{else}:\\
\;\;\;\;\frac{\frac{x}{z}}{\frac{1}{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 <= -3.368950694637007e-262) || !(z <= 1.471748363258262e-149))) {
VAR = (x * ((y + z) / z));
} else {
VAR = ((x / z) / (1.0 / (y + z)));
}
return VAR;
}




Bits error versus x




Bits error versus y




Bits error versus z
Results
| Original | 12.4 |
|---|---|
| Target | 3.1 |
| Herbie | 3.3 |
if z < -3.368950694637007e-262 or 1.471748363258262e-149 < z Initial program 12.7
rmApplied *-un-lft-identity12.7
Applied times-frac2.0
Simplified2.0
if -3.368950694637007e-262 < z < 1.471748363258262e-149Initial program 10.5
rmApplied associate-/l*12.7
rmApplied div-inv12.8
Applied associate-/r*13.3
Final simplification3.3
herbie shell --seed 2020103
(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))