\frac{x \cdot \left(y + z\right)}{z}\begin{array}{l}
\mathbf{if}\;x \le -6.32812940840826245 \cdot 10^{-198}:\\
\;\;\;\;\mathsf{fma}\left(\frac{y}{z}, x, x\right)\\
\mathbf{elif}\;x \le 2.0356444854556903 \cdot 10^{-15}:\\
\;\;\;\;\mathsf{fma}\left(\frac{x}{z}, y, x\right)\\
\mathbf{else}:\\
\;\;\;\;\frac{x}{\frac{z}{y + z}}\\
\end{array}double f(double x, double y, double z) {
double r449835 = x;
double r449836 = y;
double r449837 = z;
double r449838 = r449836 + r449837;
double r449839 = r449835 * r449838;
double r449840 = r449839 / r449837;
return r449840;
}
double f(double x, double y, double z) {
double r449841 = x;
double r449842 = -6.3281294084082624e-198;
bool r449843 = r449841 <= r449842;
double r449844 = y;
double r449845 = z;
double r449846 = r449844 / r449845;
double r449847 = fma(r449846, r449841, r449841);
double r449848 = 2.0356444854556903e-15;
bool r449849 = r449841 <= r449848;
double r449850 = r449841 / r449845;
double r449851 = fma(r449850, r449844, r449841);
double r449852 = r449844 + r449845;
double r449853 = r449845 / r449852;
double r449854 = r449841 / r449853;
double r449855 = r449849 ? r449851 : r449854;
double r449856 = r449843 ? r449847 : r449855;
return r449856;
}




Bits error versus x




Bits error versus y




Bits error versus z
| Original | 12.4 |
|---|---|
| Target | 2.9 |
| Herbie | 2.2 |
if x < -6.3281294084082624e-198Initial program 13.1
Simplified1.8
if -6.3281294084082624e-198 < x < 2.0356444854556903e-15Initial program 6.8
Taylor expanded around 0 3.6
Simplified3.8
if 2.0356444854556903e-15 < x Initial program 20.8
rmApplied associate-/l*0.1
Final simplification2.2
herbie shell --seed 2020065 +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))