\frac{x \cdot \left(y + z\right)}{z}\begin{array}{l}
\mathbf{if}\;z \le -8.075781138440941892154872470930892635259 \cdot 10^{-16} \lor \neg \left(z \le 2.717641103527439173532310107215917032371 \cdot 10^{-184}\right):\\
\;\;\;\;x \cdot \frac{y}{z} + x\\
\mathbf{else}:\\
\;\;\;\;\left(x \cdot y\right) \cdot \frac{1}{z} + x\\
\end{array}double f(double x, double y, double z) {
double r300749 = x;
double r300750 = y;
double r300751 = z;
double r300752 = r300750 + r300751;
double r300753 = r300749 * r300752;
double r300754 = r300753 / r300751;
return r300754;
}
double f(double x, double y, double z) {
double r300755 = z;
double r300756 = -8.075781138440942e-16;
bool r300757 = r300755 <= r300756;
double r300758 = 2.717641103527439e-184;
bool r300759 = r300755 <= r300758;
double r300760 = !r300759;
bool r300761 = r300757 || r300760;
double r300762 = x;
double r300763 = y;
double r300764 = r300763 / r300755;
double r300765 = r300762 * r300764;
double r300766 = r300765 + r300762;
double r300767 = r300762 * r300763;
double r300768 = 1.0;
double r300769 = r300768 / r300755;
double r300770 = r300767 * r300769;
double r300771 = r300770 + r300762;
double r300772 = r300761 ? r300766 : r300771;
return r300772;
}




Bits error versus x




Bits error versus y




Bits error versus z
Results
| Original | 12.3 |
|---|---|
| Target | 3.2 |
| Herbie | 2.1 |
if z < -8.075781138440942e-16 or 2.717641103527439e-184 < z Initial program 14.2
Simplified1.1
rmApplied fma-udef1.1
Simplified1.1
if -8.075781138440942e-16 < z < 2.717641103527439e-184Initial program 7.6
Simplified9.6
rmApplied fma-udef9.6
Simplified9.6
rmApplied div-inv9.7
Applied associate-*r*4.6
Final simplification2.1
herbie shell --seed 2019325 +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))