\frac{x \cdot \left(y + z\right)}{z}\begin{array}{l}
\mathbf{if}\;x \leq -4.26876604973354 \cdot 10^{-141} \lor \neg \left(x \leq -3.646313345375112 \cdot 10^{-283} \lor \neg \left(x \leq 5.2611451254301515 \cdot 10^{-261}\right) \land x \leq 2604.6530752999397\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 (<= x -4.26876604973354e-141)
(not
(or (<= x -3.646313345375112e-283)
(and (not (<= x 5.2611451254301515e-261))
(<= x 2604.6530752999397)))))
(/ x (/ z (+ z y)))
(+ x (/ (* x y) z))))double code(double x, double y, double z) {
return (x * (y + z)) / z;
}
double code(double x, double y, double z) {
double tmp;
if ((x <= -4.26876604973354e-141) || !((x <= -3.646313345375112e-283) || (!(x <= 5.2611451254301515e-261) && (x <= 2604.6530752999397)))) {
tmp = x / (z / (z + y));
} else {
tmp = x + ((x * y) / z);
}
return tmp;
}




Bits error versus x




Bits error versus y




Bits error versus z
Results
| Original | 12.9 |
|---|---|
| Target | 3.2 |
| Herbie | 1.8 |
if x < -4.2687660497335401e-141 or -3.64631334537511e-283 < x < 5.26114512543015153e-261 or 2604.6530752999397 < x Initial program 18.0
rmApplied associate-/l*_binary64_102531.5
if -4.2687660497335401e-141 < x < -3.64631334537511e-283 or 5.26114512543015153e-261 < x < 2604.6530752999397Initial program 4.7
Taylor expanded around 0 2.4
Final simplification1.8
herbie shell --seed 2021043
(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))