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




Bits error versus x




Bits error versus y




Bits error versus z
Results
| Original | 12.2 |
|---|---|
| Target | 3.1 |
| Herbie | 2.9 |
if z < 2.5037938774461471e-301 or 2.1382498498323363e-143 < z Initial program 12.4
rmApplied associate-/l*_binary64_141282.2
if 2.5037938774461471e-301 < z < 2.1382498498323363e-143Initial program 10.1
rmApplied clear-num_binary64_1418210.2
Final simplification2.9
herbie shell --seed 2020277
(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))