\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 r899252 = x;
double r899253 = r899252 * r899252;
double r899254 = 1.0;
double r899255 = r899253 + r899254;
double r899256 = r899252 / r899255;
return r899256;
}
double f(double x) {
double r899257 = x;
double r899258 = -957088378446.058;
bool r899259 = r899257 <= r899258;
double r899260 = 1.0;
double r899261 = r899260 / r899257;
double r899262 = r899257 * r899257;
double r899263 = r899261 / r899262;
double r899264 = r899261 - r899263;
double r899265 = 5.0;
double r899266 = pow(r899257, r899265);
double r899267 = r899260 / r899266;
double r899268 = r899264 + r899267;
double r899269 = 8137.871959944802;
bool r899270 = r899257 <= r899269;
double r899271 = fma(r899257, r899257, r899260);
double r899272 = r899257 / r899271;
double r899273 = r899270 ? r899272 : r899268;
double r899274 = r899259 ? r899268 : r899273;
return r899274;
}




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