\frac{x \cdot \left(y + z\right)}{z}\begin{array}{l}
\mathbf{if}\;z \le -8.53005333076934627 \cdot 10^{-4} \lor \neg \left(z \le 4.3903400335005515 \cdot 10^{-147}\right):\\
\;\;\;\;x \cdot \frac{y}{z} + x\\
\mathbf{else}:\\
\;\;\;\;\frac{x \cdot y}{z} + x\\
\end{array}double f(double x, double y, double z) {
double r592742 = x;
double r592743 = y;
double r592744 = z;
double r592745 = r592743 + r592744;
double r592746 = r592742 * r592745;
double r592747 = r592746 / r592744;
return r592747;
}
double f(double x, double y, double z) {
double r592748 = z;
double r592749 = -0.0008530053330769346;
bool r592750 = r592748 <= r592749;
double r592751 = 4.3903400335005515e-147;
bool r592752 = r592748 <= r592751;
double r592753 = !r592752;
bool r592754 = r592750 || r592753;
double r592755 = x;
double r592756 = y;
double r592757 = r592756 / r592748;
double r592758 = r592755 * r592757;
double r592759 = r592758 + r592755;
double r592760 = r592755 * r592756;
double r592761 = r592760 / r592748;
double r592762 = r592761 + r592755;
double r592763 = r592754 ? r592759 : r592762;
return r592763;
}




Bits error versus x




Bits error versus y




Bits error versus z
Results
| Original | 12.5 |
|---|---|
| Target | 3.2 |
| Herbie | 2.0 |
if z < -0.0008530053330769346 or 4.3903400335005515e-147 < z Initial program 14.5
Simplified2.9
rmApplied fma-udef2.9
Simplified5.1
rmApplied *-un-lft-identity5.1
Applied times-frac0.8
Simplified0.8
if -0.0008530053330769346 < z < 4.3903400335005515e-147Initial program 8.1
Simplified9.1
rmApplied fma-udef9.1
Simplified4.7
Final simplification2.0
herbie shell --seed 2020042 +o rules:numerics
(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))