\frac{x \cdot \left(y + z\right)}{z}\begin{array}{l}
\mathbf{if}\;z \leq -1.099407840975313 \cdot 10^{-163} \lor \neg \left(z \leq 1.652141365346291 \cdot 10^{+102}\right):\\
\;\;\;\;x + x \cdot \frac{y}{z}\\
\mathbf{else}:\\
\;\;\;\;x + \frac{x \cdot y}{z}\\
\end{array}(FPCore (x y z) :precision binary64 (/ (* x (+ y z)) z))
(FPCore (x y z) :precision binary64 (if (or (<= z -1.099407840975313e-163) (not (<= z 1.652141365346291e+102))) (+ x (* x (/ y z))) (+ x (/ (* x y) z))))
double code(double x, double y, double z) {
return (((double) (x * ((double) (y + z)))) / z);
}
double code(double x, double y, double z) {
double tmp;
if (((z <= -1.099407840975313e-163) || !(z <= 1.652141365346291e+102))) {
tmp = ((double) (x + ((double) (x * (y / z)))));
} else {
tmp = ((double) (x + (((double) (x * y)) / z)));
}
return tmp;
}




Bits error versus x




Bits error versus y




Bits error versus z
Results
| Original | 12.3 |
|---|---|
| Target | 2.9 |
| Herbie | 2.2 |
if z < -1.09940784097531308e-163 or 1.652141365346291e102 < z Initial program Error: 15.5 bits
SimplifiedError: 0.8 bits
if -1.09940784097531308e-163 < z < 1.652141365346291e102Initial program Error: 7.2 bits
SimplifiedError: 6.8 bits
rmApplied associate-*r/Error: 4.4 bits
Final simplificationError: 2.2 bits
herbie shell --seed 2020204
(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))