\frac{x \cdot \left(y + z\right)}{z}\begin{array}{l}
\mathbf{if}\;z \le -9.060096809735444000700599295995871436704 \cdot 10^{-285}:\\
\;\;\;\;\frac{y + z}{z} \cdot x\\
\mathbf{elif}\;z \le 2.150336063800679259738105023330353494451 \cdot 10^{-122}:\\
\;\;\;\;\left(x \cdot \left(y + z\right)\right) \cdot \frac{1}{z}\\
\mathbf{else}:\\
\;\;\;\;\frac{y + z}{z} \cdot x\\
\end{array}double f(double x, double y, double z) {
double r22569771 = x;
double r22569772 = y;
double r22569773 = z;
double r22569774 = r22569772 + r22569773;
double r22569775 = r22569771 * r22569774;
double r22569776 = r22569775 / r22569773;
return r22569776;
}
double f(double x, double y, double z) {
double r22569777 = z;
double r22569778 = -9.060096809735444e-285;
bool r22569779 = r22569777 <= r22569778;
double r22569780 = y;
double r22569781 = r22569780 + r22569777;
double r22569782 = r22569781 / r22569777;
double r22569783 = x;
double r22569784 = r22569782 * r22569783;
double r22569785 = 2.1503360638006793e-122;
bool r22569786 = r22569777 <= r22569785;
double r22569787 = r22569783 * r22569781;
double r22569788 = 1.0;
double r22569789 = r22569788 / r22569777;
double r22569790 = r22569787 * r22569789;
double r22569791 = r22569786 ? r22569790 : r22569784;
double r22569792 = r22569779 ? r22569784 : r22569791;
return r22569792;
}




Bits error versus x




Bits error versus y




Bits error versus z
Results
| Original | 12.9 |
|---|---|
| Target | 2.8 |
| Herbie | 3.1 |
if z < -9.060096809735444e-285 or 2.1503360638006793e-122 < z Initial program 13.1
rmApplied *-un-lft-identity13.1
Applied times-frac1.9
Simplified1.9
if -9.060096809735444e-285 < z < 2.1503360638006793e-122Initial program 11.0
rmApplied *-un-lft-identity11.0
Applied times-frac10.9
Simplified10.9
rmApplied div-inv11.0
Applied associate-*r*11.1
Final simplification3.1
herbie shell --seed 2019200
(FPCore (x y z)
:name "Numeric.SpecFunctions:choose from math-functions-0.1.5.2"
:herbie-target
(/ x (/ z (+ y z)))
(/ (* x (+ y z)) z))