\frac{x \cdot \left(y + z\right)}{z}\begin{array}{l}
\mathbf{if}\;z \le -1.5832163458443259 \cdot 10^{-199} \lor \neg \left(z \le 3.2770173138454184 \cdot 10^{-255}\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 <= -1.583216345844326e-199) || !(z <= 3.2770173138454184e-255))) {
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.9 |
|---|---|
| Target | 3.1 |
| Herbie | 3.1 |
if z < -1.5832163458443259e-199 or 3.2770173138454184e-255 < z Initial program 12.9
rmApplied associate-/l*2.1
if -1.5832163458443259e-199 < z < 3.2770173138454184e-255Initial program 12.2
rmApplied div-inv12.3
Final simplification3.1
herbie shell --seed 2020163
(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))