\frac{x}{x \cdot x + 1}\begin{array}{l}
\mathbf{if}\;x \le -8735329382739425.0:\\
\;\;\;\;\left(\frac{1}{{x}^{5}} + \frac{1}{x}\right) - \frac{1}{\left(x \cdot x\right) \cdot x}\\
\mathbf{elif}\;x \le 604.0333324436991:\\
\;\;\;\;x \cdot \frac{1}{(x \cdot x + 1)_*}\\
\mathbf{else}:\\
\;\;\;\;\left(\frac{1}{{x}^{5}} + \frac{1}{x}\right) - \frac{1}{\left(x \cdot x\right) \cdot x}\\
\end{array}double f(double x) {
double r17922864 = x;
double r17922865 = r17922864 * r17922864;
double r17922866 = 1.0;
double r17922867 = r17922865 + r17922866;
double r17922868 = r17922864 / r17922867;
return r17922868;
}
double f(double x) {
double r17922869 = x;
double r17922870 = -8735329382739425.0;
bool r17922871 = r17922869 <= r17922870;
double r17922872 = 1.0;
double r17922873 = 5.0;
double r17922874 = pow(r17922869, r17922873);
double r17922875 = r17922872 / r17922874;
double r17922876 = r17922872 / r17922869;
double r17922877 = r17922875 + r17922876;
double r17922878 = r17922869 * r17922869;
double r17922879 = r17922878 * r17922869;
double r17922880 = r17922872 / r17922879;
double r17922881 = r17922877 - r17922880;
double r17922882 = 604.0333324436991;
bool r17922883 = r17922869 <= r17922882;
double r17922884 = fma(r17922869, r17922869, r17922872);
double r17922885 = r17922872 / r17922884;
double r17922886 = r17922869 * r17922885;
double r17922887 = r17922883 ? r17922886 : r17922881;
double r17922888 = r17922871 ? r17922881 : r17922887;
return r17922888;
}




Bits error versus x
| Original | 14.8 |
|---|---|
| Target | 0.1 |
| Herbie | 0.0 |
if x < -8735329382739425.0 or 604.0333324436991 < x Initial program 30.7
Simplified30.7
rmApplied add-sqr-sqrt30.7
Applied associate-/r*30.6
Taylor expanded around -inf 0.0
Simplified0.0
if -8735329382739425.0 < x < 604.0333324436991Initial program 0.0
Simplified0.0
rmApplied div-inv0.0
Final simplification0.0
herbie shell --seed 2019112 +o rules:numerics
(FPCore (x)
:name "x / (x^2 + 1)"
:herbie-target
(/ 1 (+ x (/ 1 x)))
(/ x (+ (* x x) 1)))