\frac{x}{x \cdot x + 1}\begin{array}{l}
\mathbf{if}\;x \le -1.0335386412362911 \cdot 10^{25} \lor \neg \left(x \le 23741.194574337824\right):\\
\;\;\;\;\mathsf{fma}\left(1, \frac{1}{{x}^{5}}, \frac{1}{x} - 1 \cdot \frac{1}{{x}^{3}}\right)\\
\mathbf{else}:\\
\;\;\;\;x \cdot \frac{1}{\mathsf{fma}\left(x, x, 1\right)}\\
\end{array}double f(double x) {
double r82215 = x;
double r82216 = r82215 * r82215;
double r82217 = 1.0;
double r82218 = r82216 + r82217;
double r82219 = r82215 / r82218;
return r82219;
}
double f(double x) {
double r82220 = x;
double r82221 = -1.033538641236291e+25;
bool r82222 = r82220 <= r82221;
double r82223 = 23741.194574337824;
bool r82224 = r82220 <= r82223;
double r82225 = !r82224;
bool r82226 = r82222 || r82225;
double r82227 = 1.0;
double r82228 = 1.0;
double r82229 = 5.0;
double r82230 = pow(r82220, r82229);
double r82231 = r82228 / r82230;
double r82232 = r82228 / r82220;
double r82233 = 3.0;
double r82234 = pow(r82220, r82233);
double r82235 = r82228 / r82234;
double r82236 = r82227 * r82235;
double r82237 = r82232 - r82236;
double r82238 = fma(r82227, r82231, r82237);
double r82239 = fma(r82220, r82220, r82227);
double r82240 = r82228 / r82239;
double r82241 = r82220 * r82240;
double r82242 = r82226 ? r82238 : r82241;
return r82242;
}




Bits error versus x
| Original | 14.8 |
|---|---|
| Target | 0.1 |
| Herbie | 0.0 |
if x < -1.033538641236291e+25 or 23741.194574337824 < x Initial program 31.3
rmApplied div-inv31.4
Simplified31.4
Taylor expanded around inf 0.0
Simplified0.0
if -1.033538641236291e+25 < x < 23741.194574337824Initial program 0.0
rmApplied div-inv0.0
Simplified0.0
Final simplification0.0
herbie shell --seed 2020034 +o rules:numerics
(FPCore (x)
:name "x / (x^2 + 1)"
:precision binary64
:herbie-target
(/ 1 (+ x (/ 1 x)))
(/ x (+ (* x x) 1)))