\frac{x \cdot \left(y + z\right)}{z}\begin{array}{l}
\mathbf{if}\;z \le -4.483651780214682313685859092672612032561 \cdot 10^{-120} \lor \neg \left(z \le 3.007853078206601173238028616620457685735 \cdot 10^{-33}\right):\\
\;\;\;\;\frac{x}{\frac{z}{y}} + x\\
\mathbf{else}:\\
\;\;\;\;\frac{x \cdot y}{z} + x\\
\end{array}double f(double x, double y, double z) {
double r240308 = x;
double r240309 = y;
double r240310 = z;
double r240311 = r240309 + r240310;
double r240312 = r240308 * r240311;
double r240313 = r240312 / r240310;
return r240313;
}
double f(double x, double y, double z) {
double r240314 = z;
double r240315 = -4.483651780214682e-120;
bool r240316 = r240314 <= r240315;
double r240317 = 3.0078530782066012e-33;
bool r240318 = r240314 <= r240317;
double r240319 = !r240318;
bool r240320 = r240316 || r240319;
double r240321 = x;
double r240322 = y;
double r240323 = r240314 / r240322;
double r240324 = r240321 / r240323;
double r240325 = r240324 + r240321;
double r240326 = r240321 * r240322;
double r240327 = r240326 / r240314;
double r240328 = r240327 + r240321;
double r240329 = r240320 ? r240325 : r240328;
return r240329;
}




Bits error versus x




Bits error versus y




Bits error versus z
Results
| Original | 13.0 |
|---|---|
| Target | 3.0 |
| Herbie | 2.0 |
if z < -4.483651780214682e-120 or 3.0078530782066012e-33 < z Initial program 15.2
Simplified2.5
rmApplied fma-udef2.5
Simplified5.0
rmApplied *-un-lft-identity5.0
rmApplied associate-/l*0.5
if -4.483651780214682e-120 < z < 3.0078530782066012e-33Initial program 8.2
Simplified9.3
rmApplied fma-udef9.3
Simplified5.1
rmApplied *-un-lft-identity5.1
Final simplification2.0
herbie shell --seed 2019208 +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))