\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 r281776 = x;
double r281777 = y;
double r281778 = z;
double r281779 = r281777 + r281778;
double r281780 = r281776 * r281779;
double r281781 = r281780 / r281778;
return r281781;
}
double f(double x, double y, double z) {
double r281782 = z;
double r281783 = -8.075781138440942e-16;
bool r281784 = r281782 <= r281783;
double r281785 = 2.717641103527439e-184;
bool r281786 = r281782 <= r281785;
double r281787 = !r281786;
bool r281788 = r281784 || r281787;
double r281789 = x;
double r281790 = y;
double r281791 = r281790 / r281782;
double r281792 = r281789 * r281791;
double r281793 = r281792 + r281789;
double r281794 = r281789 * r281790;
double r281795 = 1.0;
double r281796 = r281795 / r281782;
double r281797 = r281794 * r281796;
double r281798 = r281797 + r281789;
double r281799 = r281788 ? r281793 : r281798;
return r281799;
}




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))