\left(\frac{1}{x + 1} - \frac{2}{x}\right) + \frac{1}{x - 1}\frac{\frac{2}{x}}{x \cdot x - 1}double f(double x) {
double r88614 = 1.0;
double r88615 = x;
double r88616 = r88615 + r88614;
double r88617 = r88614 / r88616;
double r88618 = 2.0;
double r88619 = r88618 / r88615;
double r88620 = r88617 - r88619;
double r88621 = r88615 - r88614;
double r88622 = r88614 / r88621;
double r88623 = r88620 + r88622;
return r88623;
}
double f(double x) {
double r88624 = 2.0;
double r88625 = x;
double r88626 = r88624 / r88625;
double r88627 = r88625 * r88625;
double r88628 = 1.0;
double r88629 = r88627 - r88628;
double r88630 = r88626 / r88629;
return r88630;
}




Bits error versus x
Results
| Original | 9.9 |
|---|---|
| Target | 0.3 |
| Herbie | 0.1 |
Initial program 9.9
rmApplied frac-sub25.6
Applied frac-add25.0
Taylor expanded around 0 0.3
Taylor expanded around 0 0.3
rmApplied unpow30.3
Applied distribute-rgt-out--0.3
Applied associate-/r*0.1
Final simplification0.1
herbie shell --seed 2019350
(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))))