\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 r19759548 = 1.0;
double r19759549 = x;
double r19759550 = r19759549 + r19759548;
double r19759551 = r19759548 / r19759550;
double r19759552 = 2.0;
double r19759553 = r19759552 / r19759549;
double r19759554 = r19759551 - r19759553;
double r19759555 = r19759549 - r19759548;
double r19759556 = r19759548 / r19759555;
double r19759557 = r19759554 + r19759556;
return r19759557;
}
double f(double x) {
double r19759558 = 2.0;
double r19759559 = x;
double r19759560 = 1.0;
double r19759561 = r19759559 + r19759560;
double r19759562 = r19759561 * r19759559;
double r19759563 = r19759558 / r19759562;
double r19759564 = r19759559 - r19759560;
double r19759565 = r19759563 / r19759564;
return r19759565;
}




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