\frac{x}{x \cdot x + 1}\begin{array}{l}
\mathbf{if}\;x \le -957088378446.058:\\
\;\;\;\;\left(\frac{1}{x} - \frac{\frac{1}{x}}{x \cdot x}\right) + \frac{1}{{x}^{5}}\\
\mathbf{elif}\;x \le 8137.871959944802:\\
\;\;\;\;\frac{x}{\mathsf{fma}\left(x, x, 1\right)}\\
\mathbf{else}:\\
\;\;\;\;\left(\frac{1}{x} - \frac{\frac{1}{x}}{x \cdot x}\right) + \frac{1}{{x}^{5}}\\
\end{array}double f(double x) {
double r2135014 = x;
double r2135015 = r2135014 * r2135014;
double r2135016 = 1.0;
double r2135017 = r2135015 + r2135016;
double r2135018 = r2135014 / r2135017;
return r2135018;
}
double f(double x) {
double r2135019 = x;
double r2135020 = -957088378446.058;
bool r2135021 = r2135019 <= r2135020;
double r2135022 = 1.0;
double r2135023 = r2135022 / r2135019;
double r2135024 = r2135019 * r2135019;
double r2135025 = r2135023 / r2135024;
double r2135026 = r2135023 - r2135025;
double r2135027 = 5.0;
double r2135028 = pow(r2135019, r2135027);
double r2135029 = r2135022 / r2135028;
double r2135030 = r2135026 + r2135029;
double r2135031 = 8137.871959944802;
bool r2135032 = r2135019 <= r2135031;
double r2135033 = fma(r2135019, r2135019, r2135022);
double r2135034 = r2135019 / r2135033;
double r2135035 = r2135032 ? r2135034 : r2135030;
double r2135036 = r2135021 ? r2135030 : r2135035;
return r2135036;
}




Bits error versus x
| Original | 15.1 |
|---|---|
| Target | 0.1 |
| Herbie | 0.0 |
if x < -957088378446.058 or 8137.871959944802 < x Initial program 31.2
Simplified31.2
rmApplied add-sqr-sqrt31.2
Applied associate-/r*31.1
rmApplied div-inv31.1
Applied associate-/l*31.2
Simplified31.2
Taylor expanded around -inf 0.0
Simplified0.0
if -957088378446.058 < x < 8137.871959944802Initial program 0.0
Simplified0.0
rmApplied add-sqr-sqrt0.0
Applied associate-/r*0.0
rmApplied div-inv0.0
Applied associate-/l*0.0
Simplified0.0
Final simplification0.0
herbie shell --seed 2019151 +o rules:numerics
(FPCore (x)
:name "x / (x^2 + 1)"
:herbie-target
(/ 1 (+ x (/ 1 x)))
(/ x (+ (* x x) 1)))