\frac{x \cdot \left(y + z\right)}{z}\begin{array}{l}
\mathbf{if}\;z \le -8.82644305233315512 \cdot 10^{-5} \lor \neg \left(z \le 4.9542007534756208 \cdot 10^{-114}\right):\\
\;\;\;\;\frac{x}{\frac{z}{y + z}}\\
\mathbf{else}:\\
\;\;\;\;\frac{1}{\frac{z}{x \cdot \left(y + z\right)}}\\
\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 <= -8.826443052333155e-05) || !(z <= 4.954200753475621e-114))) {
VAR = (x / (z / (y + z)));
} else {
VAR = (1.0 / (z / (x * (y + z))));
}
return VAR;
}




Bits error versus x




Bits error versus y




Bits error versus z
Results
| Original | 12.4 |
|---|---|
| Target | 2.9 |
| Herbie | 2.5 |
if z < -8.826443052333155e-05 or 4.954200753475621e-114 < z Initial program 14.9
rmApplied associate-/l*0.3
if -8.826443052333155e-05 < z < 4.954200753475621e-114Initial program 7.1
rmApplied clear-num7.2
Final simplification2.5
herbie shell --seed 2020105
(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))