\frac{x \cdot \left(y + z\right)}{z}\begin{array}{l}
\mathbf{if}\;z \le -2.15145309439867013 \cdot 10^{-167} \lor \neg \left(z \le 2.0059309513327617 \cdot 10^{-227}\right):\\
\;\;\;\;\frac{x}{\frac{z}{y + z}}\\
\mathbf{else}:\\
\;\;\;\;\frac{x}{z} \cdot \left(y + z\right)\\
\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 (((z <= -2.15145309439867e-167) || !(z <= 2.0059309513327617e-227))) {
VAR = (x / (z / (y + z)));
} else {
VAR = ((x / z) * (y + z));
}
return VAR;
}




Bits error versus x




Bits error versus y




Bits error versus z
Results
| Original | 12.5 |
|---|---|
| Target | 3.2 |
| Herbie | 3.0 |
if z < -2.15145309439867e-167 or 2.0059309513327617e-227 < z Initial program 12.6
rmApplied associate-/l*1.6
if -2.15145309439867e-167 < z < 2.0059309513327617e-227Initial program 11.6
rmApplied associate-/l*13.2
rmApplied associate-/r/11.9
Final simplification3.0
herbie shell --seed 2020091
(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))