\left(\frac{1}{x + 1} - \frac{2}{x}\right) + \frac{1}{x - 1}\begin{array}{l}
\mathbf{if}\;x \le -109.157505507267487 \lor \neg \left(x \le 120.214345156184848\right):\\
\;\;\;\;\frac{2}{{x}^{5}} + \left(\frac{\frac{2}{x \cdot x}}{x} + \frac{2}{{x}^{7}}\right)\\
\mathbf{else}:\\
\;\;\;\;\frac{1}{x - 1} - \frac{2 \cdot \left(x + 1\right) - x \cdot 1}{x \cdot \left(x + 1\right)}\\
\end{array}double f(double x) {
double r116638 = 1.0;
double r116639 = x;
double r116640 = r116639 + r116638;
double r116641 = r116638 / r116640;
double r116642 = 2.0;
double r116643 = r116642 / r116639;
double r116644 = r116641 - r116643;
double r116645 = r116639 - r116638;
double r116646 = r116638 / r116645;
double r116647 = r116644 + r116646;
return r116647;
}
double f(double x) {
double r116648 = x;
double r116649 = -109.15750550726749;
bool r116650 = r116648 <= r116649;
double r116651 = 120.21434515618485;
bool r116652 = r116648 <= r116651;
double r116653 = !r116652;
bool r116654 = r116650 || r116653;
double r116655 = 2.0;
double r116656 = 5.0;
double r116657 = pow(r116648, r116656);
double r116658 = r116655 / r116657;
double r116659 = r116648 * r116648;
double r116660 = r116655 / r116659;
double r116661 = r116660 / r116648;
double r116662 = 7.0;
double r116663 = pow(r116648, r116662);
double r116664 = r116655 / r116663;
double r116665 = r116661 + r116664;
double r116666 = r116658 + r116665;
double r116667 = 1.0;
double r116668 = r116648 - r116667;
double r116669 = r116667 / r116668;
double r116670 = r116648 + r116667;
double r116671 = r116655 * r116670;
double r116672 = r116648 * r116667;
double r116673 = r116671 - r116672;
double r116674 = r116648 * r116670;
double r116675 = r116673 / r116674;
double r116676 = r116669 - r116675;
double r116677 = r116654 ? r116666 : r116676;
return r116677;
}




Bits error versus x
Results
| Original | 9.8 |
|---|---|
| Target | 0.3 |
| Herbie | 0.1 |
if x < -109.15750550726749 or 120.21434515618485 < x Initial program 19.4
Simplified19.4
Taylor expanded around inf 0.5
Simplified0.5
rmApplied unpow30.5
Applied associate-/r*0.1
if -109.15750550726749 < x < 120.21434515618485Initial program 0.0
Simplified0.0
rmApplied *-un-lft-identity0.0
Applied *-un-lft-identity0.0
Applied times-frac0.0
Applied *-un-lft-identity0.0
Applied *-un-lft-identity0.0
Applied times-frac0.0
Applied distribute-lft-out--0.0
rmApplied frac-sub0.0
Final simplification0.1
herbie shell --seed 2019199 +o rules:numerics
(FPCore (x)
:name "3frac (problem 3.3.3)"
:herbie-target
(/ 2.0 (* x (- (* x x) 1.0)))
(+ (- (/ 1.0 (+ x 1.0)) (/ 2.0 x)) (/ 1.0 (- x 1.0))))