\frac{x \cdot \left(y + z\right)}{z}\begin{array}{l}
\mathbf{if}\;z \leq -4.719214907735761 \cdot 10^{-47} \lor \neg \left(z \leq 3.2862580425901126 \cdot 10^{-67}\right):\\
\;\;\;\;\frac{x}{\frac{z}{z + y}}\\
\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 -4.719214907735761e-47) (not (<= z 3.2862580425901126e-67))) (/ x (/ z (+ z y))) (+ 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 <= -4.719214907735761e-47) || !(z <= 3.2862580425901126e-67))) {
tmp = (x / (z / ((double) (z + y))));
} 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.4 |
|---|---|
| Target | 3.2 |
| Herbie | 1.8 |
if z < -4.719214907735761e-47 or 3.28625804259011263e-67 < z Initial program 14.8
rmApplied associate-/l*_binary640.3
if -4.719214907735761e-47 < z < 3.28625804259011263e-67Initial program 7.8
Taylor expanded around 0 4.8
Simplified4.8
Final simplification1.8
herbie shell --seed 2020210
(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))