\left(\frac{1}{x + 1} - \frac{2}{x}\right) + \frac{1}{x - 1}\begin{array}{l}
\mathbf{if}\;x \le -118.48907173078551:\\
\;\;\;\;\frac{2}{{x}^{7}} + \left(\frac{\frac{2}{x}}{x \cdot x} + \frac{2}{{x}^{5}}\right)\\
\mathbf{elif}\;x \le 109.57651104194328:\\
\;\;\;\;\left(\frac{1}{1 + x} - \frac{2}{x}\right) + \frac{1}{x - 1}\\
\mathbf{else}:\\
\;\;\;\;\frac{2}{{x}^{7}} + \left(\frac{2}{{x}^{5}} + \frac{2}{{x}^{3}}\right)\\
\end{array}double f(double x) {
double r3341411 = 1.0;
double r3341412 = x;
double r3341413 = r3341412 + r3341411;
double r3341414 = r3341411 / r3341413;
double r3341415 = 2.0;
double r3341416 = r3341415 / r3341412;
double r3341417 = r3341414 - r3341416;
double r3341418 = r3341412 - r3341411;
double r3341419 = r3341411 / r3341418;
double r3341420 = r3341417 + r3341419;
return r3341420;
}
double f(double x) {
double r3341421 = x;
double r3341422 = -118.48907173078551;
bool r3341423 = r3341421 <= r3341422;
double r3341424 = 2.0;
double r3341425 = 7.0;
double r3341426 = pow(r3341421, r3341425);
double r3341427 = r3341424 / r3341426;
double r3341428 = r3341424 / r3341421;
double r3341429 = r3341421 * r3341421;
double r3341430 = r3341428 / r3341429;
double r3341431 = 5.0;
double r3341432 = pow(r3341421, r3341431);
double r3341433 = r3341424 / r3341432;
double r3341434 = r3341430 + r3341433;
double r3341435 = r3341427 + r3341434;
double r3341436 = 109.57651104194328;
bool r3341437 = r3341421 <= r3341436;
double r3341438 = 1.0;
double r3341439 = r3341438 + r3341421;
double r3341440 = r3341438 / r3341439;
double r3341441 = r3341440 - r3341428;
double r3341442 = r3341421 - r3341438;
double r3341443 = r3341438 / r3341442;
double r3341444 = r3341441 + r3341443;
double r3341445 = 3.0;
double r3341446 = pow(r3341421, r3341445);
double r3341447 = r3341424 / r3341446;
double r3341448 = r3341433 + r3341447;
double r3341449 = r3341427 + r3341448;
double r3341450 = r3341437 ? r3341444 : r3341449;
double r3341451 = r3341423 ? r3341435 : r3341450;
return r3341451;
}




Bits error versus x
Results
| Original | 9.7 |
|---|---|
| Target | 0.3 |
| Herbie | 0.2 |
if x < -118.48907173078551Initial program 19.4
rmApplied *-un-lft-identity19.4
Applied *-un-lft-identity19.4
Applied distribute-lft-out--19.4
Applied associate-/r*19.4
Simplified19.4
rmApplied flip-+19.4
Taylor expanded around -inf 0.5
Simplified0.5
Taylor expanded around -inf 0.5
Simplified0.1
if -118.48907173078551 < x < 109.57651104194328Initial program 0.0
rmApplied *-un-lft-identity0.0
Applied *-un-lft-identity0.0
Applied distribute-lft-out--0.0
Applied associate-/r*0.0
Simplified0.0
if 109.57651104194328 < x Initial program 19.7
rmApplied *-un-lft-identity19.7
Applied *-un-lft-identity19.7
Applied distribute-lft-out--19.7
Applied associate-/r*19.7
Simplified19.7
rmApplied flip-+19.7
Taylor expanded around -inf 0.5
Simplified0.6
rmApplied pow20.6
Applied pow-plus0.5
Simplified0.5
Final simplification0.2
herbie shell --seed 2019138 +o rules:numerics
(FPCore (x)
:name "3frac (problem 3.3.3)"
:herbie-target
(/ 2 (* x (- (* x x) 1)))
(+ (- (/ 1 (+ x 1)) (/ 2 x)) (/ 1 (- x 1))))