\frac{x \cdot \left(y + z\right)}{z}\begin{array}{l}
\mathbf{if}\;x \le -4.459073850942770749159394653374215512439 \cdot 10^{-97}:\\
\;\;\;\;x + x \cdot \frac{y}{z}\\
\mathbf{elif}\;x \le 6.417038597580476198640985321546549672309 \cdot 10^{-13}:\\
\;\;\;\;\frac{1}{z} \cdot \left(y \cdot x\right) + x\\
\mathbf{else}:\\
\;\;\;\;x + x \cdot \frac{y}{z}\\
\end{array}double f(double x, double y, double z) {
double r18012279 = x;
double r18012280 = y;
double r18012281 = z;
double r18012282 = r18012280 + r18012281;
double r18012283 = r18012279 * r18012282;
double r18012284 = r18012283 / r18012281;
return r18012284;
}
double f(double x, double y, double z) {
double r18012285 = x;
double r18012286 = -4.459073850942771e-97;
bool r18012287 = r18012285 <= r18012286;
double r18012288 = y;
double r18012289 = z;
double r18012290 = r18012288 / r18012289;
double r18012291 = r18012285 * r18012290;
double r18012292 = r18012285 + r18012291;
double r18012293 = 6.417038597580476e-13;
bool r18012294 = r18012285 <= r18012293;
double r18012295 = 1.0;
double r18012296 = r18012295 / r18012289;
double r18012297 = r18012288 * r18012285;
double r18012298 = r18012296 * r18012297;
double r18012299 = r18012298 + r18012285;
double r18012300 = r18012294 ? r18012299 : r18012292;
double r18012301 = r18012287 ? r18012292 : r18012300;
return r18012301;
}




Bits error versus x




Bits error versus y




Bits error versus z
Results
| Original | 12.2 |
|---|---|
| Target | 3.1 |
| Herbie | 1.6 |
if x < -4.459073850942771e-97 or 6.417038597580476e-13 < x Initial program 18.6
Simplified6.2
rmApplied fma-udef6.2
rmApplied add-cube-cbrt6.6
Applied *-un-lft-identity6.6
Applied times-frac6.6
Applied associate-*r*1.9
Simplified1.9
rmApplied *-un-lft-identity1.9
Applied associate-*l*1.9
Simplified0.4
rmApplied div-inv0.5
Simplified0.5
if -4.459073850942771e-97 < x < 6.417038597580476e-13Initial program 5.4
Simplified3.2
rmApplied fma-udef3.2
rmApplied div-inv3.3
Applied associate-*r*2.9
Final simplification1.6
herbie shell --seed 2019172 +o rules:numerics
(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))