\frac{x \cdot \left(y + z\right)}{z}\begin{array}{l}
\mathbf{if}\;z \le -7.491778140344410199247807476987183548672 \cdot 10^{-177}:\\
\;\;\;\;\mathsf{fma}\left(\frac{y}{z}, x, x\right)\\
\mathbf{elif}\;z \le 7.318632377525780595545793146364737579954 \cdot 10^{-214}:\\
\;\;\;\;\mathsf{fma}\left(\frac{x}{z}, y, x\right)\\
\mathbf{else}:\\
\;\;\;\;\frac{x}{\frac{z}{y}} + x\\
\end{array}double f(double x, double y, double z) {
double r297616 = x;
double r297617 = y;
double r297618 = z;
double r297619 = r297617 + r297618;
double r297620 = r297616 * r297619;
double r297621 = r297620 / r297618;
return r297621;
}
double f(double x, double y, double z) {
double r297622 = z;
double r297623 = -7.49177814034441e-177;
bool r297624 = r297622 <= r297623;
double r297625 = y;
double r297626 = r297625 / r297622;
double r297627 = x;
double r297628 = fma(r297626, r297627, r297627);
double r297629 = 7.318632377525781e-214;
bool r297630 = r297622 <= r297629;
double r297631 = r297627 / r297622;
double r297632 = fma(r297631, r297625, r297627);
double r297633 = r297622 / r297625;
double r297634 = r297627 / r297633;
double r297635 = r297634 + r297627;
double r297636 = r297630 ? r297632 : r297635;
double r297637 = r297624 ? r297628 : r297636;
return r297637;
}




Bits error versus x




Bits error versus y




Bits error versus z
| Original | 12.4 |
|---|---|
| Target | 3.0 |
| Herbie | 3.1 |
if z < -7.49177814034441e-177Initial program 12.3
Simplified1.6
if -7.49177814034441e-177 < z < 7.318632377525781e-214Initial program 11.6
Simplified13.5
Taylor expanded around 0 8.6
Simplified13.1
if 7.318632377525781e-214 < z Initial program 12.6
Simplified1.9
Taylor expanded around 0 4.5
Simplified4.0
rmApplied fma-udef4.0
Simplified4.5
rmApplied associate-/l*1.6
Final simplification3.1
herbie shell --seed 2019326 +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))