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




Bits error versus x




Bits error versus y




Bits error versus z
Results
| Original | 13.2 |
|---|---|
| Target | 2.9 |
| Herbie | 2.5 |
if z < 3.103957478426698e-257 or 1.8465527700659985e89 < z Initial program 15.8
rmApplied associate-/l*2.4
rmApplied div-inv2.5
if 3.103957478426698e-257 < z < 1.8465527700659985e89Initial program 5.7
Taylor expanded around 0 2.5
Final simplification2.5
herbie shell --seed 2020152
(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))