\frac{x \cdot \left(y + z\right)}{z}\begin{array}{l}
\mathbf{if}\;x \le 2.0734916858130907 \cdot 10^{-270} \lor \neg \left(x \le 4.09342771190518611 \cdot 10^{-16}\right):\\
\;\;\;\;\frac{x}{\frac{z}{y + z}}\\
\mathbf{else}:\\
\;\;\;\;\frac{x \cdot y}{z} + x\\
\end{array}double code(double x, double y, double z) {
return ((x * (y + z)) / z);
}
double code(double x, double y, double z) {
double VAR;
if (((x <= 2.0734916858130907e-270) || !(x <= 4.093427711905186e-16))) {
VAR = (x / (z / (y + z)));
} else {
VAR = (((x * y) / z) + x);
}
return VAR;
}




Bits error versus x




Bits error versus y




Bits error versus z
Results
| Original | 12.3 |
|---|---|
| Target | 2.9 |
| Herbie | 2.2 |
if x < 2.0734916858130907e-270 or 4.093427711905186e-16 < x Initial program 14.8
rmApplied associate-/l*2.3
if 2.0734916858130907e-270 < x < 4.093427711905186e-16Initial program 4.1
Taylor expanded around 0 2.2
Final simplification2.2
herbie shell --seed 2020079
(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))