\frac{x \cdot \left(y + z\right)}{z}\begin{array}{l}
\mathbf{if}\;z \le -7.2427517272985975 \cdot 10^{-264} \lor \neg \left(z \le 2.1672265956236841 \cdot 10^{-88}\right):\\
\;\;\;\;\frac{x}{\frac{z}{y + z}}\\
\mathbf{else}:\\
\;\;\;\;\left(x \cdot \left(y + z\right)\right) \cdot \frac{1}{z}\\
\end{array}double code(double x, double y, double z) {
return ((double) (((double) (x * ((double) (y + z)))) / z));
}
double code(double x, double y, double z) {
double VAR;
if (((z <= -7.2427517272985975e-264) || !(z <= 2.167226595623684e-88))) {
VAR = ((double) (x / ((double) (z / ((double) (y + z))))));
} else {
VAR = ((double) (((double) (x * ((double) (y + z)))) * ((double) (1.0 / z))));
}
return VAR;
}




Bits error versus x




Bits error versus y




Bits error versus z
Results
| Original | 12.4 |
|---|---|
| Target | 3.3 |
| Herbie | 3.2 |
if z < -7.2427517272985975e-264 or 2.1672265956236841e-88 < z Initial program 12.9
rmApplied associate-/l*1.7
if -7.2427517272985975e-264 < z < 2.1672265956236841e-88Initial program 10.3
rmApplied div-inv10.4
Final simplification3.2
herbie shell --seed 2020150
(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))