\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 r22487446 = x;
double r22487447 = y;
double r22487448 = z;
double r22487449 = r22487447 + r22487448;
double r22487450 = r22487446 * r22487449;
double r22487451 = r22487450 / r22487448;
return r22487451;
}
double f(double x, double y, double z) {
double r22487452 = x;
double r22487453 = -4.459073850942771e-97;
bool r22487454 = r22487452 <= r22487453;
double r22487455 = y;
double r22487456 = z;
double r22487457 = r22487455 / r22487456;
double r22487458 = r22487452 * r22487457;
double r22487459 = r22487452 + r22487458;
double r22487460 = 6.417038597580476e-13;
bool r22487461 = r22487452 <= r22487460;
double r22487462 = 1.0;
double r22487463 = r22487462 / r22487456;
double r22487464 = r22487455 * r22487452;
double r22487465 = r22487463 * r22487464;
double r22487466 = r22487465 + r22487452;
double r22487467 = r22487461 ? r22487466 : r22487459;
double r22487468 = r22487454 ? r22487459 : r22487467;
return r22487468;
}




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