\left(\frac{1}{x + 1} - \frac{2}{x}\right) + \frac{1}{x - 1}\frac{\frac{2}{x + -1}}{\left(x + 1\right) \cdot x}double f(double x) {
double r5249991 = 1.0;
double r5249992 = x;
double r5249993 = r5249992 + r5249991;
double r5249994 = r5249991 / r5249993;
double r5249995 = 2.0;
double r5249996 = r5249995 / r5249992;
double r5249997 = r5249994 - r5249996;
double r5249998 = r5249992 - r5249991;
double r5249999 = r5249991 / r5249998;
double r5250000 = r5249997 + r5249999;
return r5250000;
}
double f(double x) {
double r5250001 = 2.0;
double r5250002 = x;
double r5250003 = -1.0;
double r5250004 = r5250002 + r5250003;
double r5250005 = r5250001 / r5250004;
double r5250006 = 1.0;
double r5250007 = r5250002 + r5250006;
double r5250008 = r5250007 * r5250002;
double r5250009 = r5250005 / r5250008;
return r5250009;
}




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