\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):\\
\;\;\;\;\left(1 \cdot \frac{1}{{x}^{5}} + \frac{1}{x}\right) - 1 \cdot \frac{1}{{x}^{3}}\\
\mathbf{else}:\\
\;\;\;\;x \cdot \frac{1}{x \cdot x + 1}\\
\end{array}double f(double x) {
double r52284 = x;
double r52285 = r52284 * r52284;
double r52286 = 1.0;
double r52287 = r52285 + r52286;
double r52288 = r52284 / r52287;
return r52288;
}
double f(double x) {
double r52289 = x;
double r52290 = -1.033538641236291e+25;
bool r52291 = r52289 <= r52290;
double r52292 = 23741.194574337824;
bool r52293 = r52289 <= r52292;
double r52294 = !r52293;
bool r52295 = r52291 || r52294;
double r52296 = 1.0;
double r52297 = 1.0;
double r52298 = 5.0;
double r52299 = pow(r52289, r52298);
double r52300 = r52297 / r52299;
double r52301 = r52296 * r52300;
double r52302 = r52297 / r52289;
double r52303 = r52301 + r52302;
double r52304 = 3.0;
double r52305 = pow(r52289, r52304);
double r52306 = r52297 / r52305;
double r52307 = r52296 * r52306;
double r52308 = r52303 - r52307;
double r52309 = r52289 * r52289;
double r52310 = r52309 + r52296;
double r52311 = r52297 / r52310;
double r52312 = r52289 * r52311;
double r52313 = r52295 ? r52308 : r52312;
return r52313;
}




Bits error versus x
Results
| 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
rmApplied flip-+49.4
Applied associate-/r/49.4
Applied associate-*r*49.4
Simplified49.4
Taylor expanded around inf 0.0
if -1.033538641236291e+25 < x < 23741.194574337824Initial program 0.0
rmApplied div-inv0.0
Final simplification0.0
herbie shell --seed 2020034
(FPCore (x)
:name "x / (x^2 + 1)"
:precision binary64
:herbie-target
(/ 1 (+ x (/ 1 x)))
(/ x (+ (* x x) 1)))