\left(\frac{1}{x + 1} - \frac{2}{x}\right) + \frac{1}{x - 1}\frac{\frac{2}{\left(x + 1\right) \cdot x}}{x - 1}double f(double x) {
double r2840732 = 1.0;
double r2840733 = x;
double r2840734 = r2840733 + r2840732;
double r2840735 = r2840732 / r2840734;
double r2840736 = 2.0;
double r2840737 = r2840736 / r2840733;
double r2840738 = r2840735 - r2840737;
double r2840739 = r2840733 - r2840732;
double r2840740 = r2840732 / r2840739;
double r2840741 = r2840738 + r2840740;
return r2840741;
}
double f(double x) {
double r2840742 = 2.0;
double r2840743 = x;
double r2840744 = 1.0;
double r2840745 = r2840743 + r2840744;
double r2840746 = r2840745 * r2840743;
double r2840747 = r2840742 / r2840746;
double r2840748 = r2840743 - r2840744;
double r2840749 = r2840747 / r2840748;
return r2840749;
}




Bits error versus x
Results
| Original | 10.0 |
|---|---|
| Target | 0.3 |
| Herbie | 0.1 |
Initial program 10.0
rmApplied frac-sub26.2
Applied frac-add25.7
Taylor expanded around inf 0.3
rmApplied associate-/r*0.1
Final simplification0.1
herbie shell --seed 2019135
(FPCore (x)
:name "3frac (problem 3.3.3)"
:herbie-target
(/ 2 (* x (- (* x x) 1)))
(+ (- (/ 1 (+ x 1)) (/ 2 x)) (/ 1 (- x 1))))