\left(\frac{1}{x + 1} - \frac{2}{x}\right) + \frac{1}{x - 1}\begin{array}{l}
\mathbf{if}\;x \le -118.866645563045708 \lor \neg \left(x \le 111.79023992954416\right):\\
\;\;\;\;2 \cdot \left(\left(\frac{1}{{x}^{5}} + {x}^{-3}\right) + \frac{1}{{x}^{7}}\right)\\
\mathbf{else}:\\
\;\;\;\;\left(\frac{1}{x + 1} - \frac{2}{x}\right) + \frac{1}{x \cdot x - 1 \cdot 1} \cdot \left(x + 1\right)\\
\end{array}double f(double x) {
double r144356 = 1.0;
double r144357 = x;
double r144358 = r144357 + r144356;
double r144359 = r144356 / r144358;
double r144360 = 2.0;
double r144361 = r144360 / r144357;
double r144362 = r144359 - r144361;
double r144363 = r144357 - r144356;
double r144364 = r144356 / r144363;
double r144365 = r144362 + r144364;
return r144365;
}
double f(double x) {
double r144366 = x;
double r144367 = -118.86664556304571;
bool r144368 = r144366 <= r144367;
double r144369 = 111.79023992954416;
bool r144370 = r144366 <= r144369;
double r144371 = !r144370;
bool r144372 = r144368 || r144371;
double r144373 = 2.0;
double r144374 = 1.0;
double r144375 = 5.0;
double r144376 = pow(r144366, r144375);
double r144377 = r144374 / r144376;
double r144378 = -3.0;
double r144379 = pow(r144366, r144378);
double r144380 = r144377 + r144379;
double r144381 = 7.0;
double r144382 = pow(r144366, r144381);
double r144383 = r144374 / r144382;
double r144384 = r144380 + r144383;
double r144385 = r144373 * r144384;
double r144386 = 1.0;
double r144387 = r144366 + r144386;
double r144388 = r144386 / r144387;
double r144389 = r144373 / r144366;
double r144390 = r144388 - r144389;
double r144391 = r144366 * r144366;
double r144392 = r144386 * r144386;
double r144393 = r144391 - r144392;
double r144394 = r144386 / r144393;
double r144395 = r144394 * r144387;
double r144396 = r144390 + r144395;
double r144397 = r144372 ? r144385 : r144396;
return r144397;
}




Bits error versus x
Results
| Original | 9.8 |
|---|---|
| Target | 0.3 |
| Herbie | 0.0 |
if x < -118.86664556304571 or 111.79023992954416 < x Initial program 19.7
rmApplied flip--49.8
Applied associate-/r/52.8
Taylor expanded around inf 0.5
Simplified0.5
rmApplied pow-flip0.0
Simplified0.0
if -118.86664556304571 < x < 111.79023992954416Initial program 0.0
rmApplied flip--0.0
Applied associate-/r/0.0
Final simplification0.0
herbie shell --seed 2020042 +o rules:numerics
(FPCore (x)
:name "3frac (problem 3.3.3)"
:precision binary64
:herbie-target
(/ 2 (* x (- (* x x) 1)))
(+ (- (/ 1 (+ x 1)) (/ 2 x)) (/ 1 (- x 1))))