\left(\frac{1}{x + 1} - \frac{2}{x}\right) + \frac{1}{x - 1}\frac{\frac{2}{x \cdot x - 1 \cdot 1}}{\frac{x + 1}{x + 1} \cdot x}double f(double x) {
double r110996 = 1.0;
double r110997 = x;
double r110998 = r110997 + r110996;
double r110999 = r110996 / r110998;
double r111000 = 2.0;
double r111001 = r111000 / r110997;
double r111002 = r110999 - r111001;
double r111003 = r110997 - r110996;
double r111004 = r110996 / r111003;
double r111005 = r111002 + r111004;
return r111005;
}
double f(double x) {
double r111006 = 2.0;
double r111007 = x;
double r111008 = r111007 * r111007;
double r111009 = 1.0;
double r111010 = r111009 * r111009;
double r111011 = r111008 - r111010;
double r111012 = r111006 / r111011;
double r111013 = r111007 + r111009;
double r111014 = r111013 / r111013;
double r111015 = r111014 * r111007;
double r111016 = r111012 / r111015;
return r111016;
}




Bits error versus x
Results
| Original | 9.9 |
|---|---|
| Target | 0.3 |
| Herbie | 0.1 |
Initial program 9.9
Simplified9.9
rmApplied frac-sub25.7
Applied frac-add25.3
Simplified25.3
Taylor expanded around 0 0.3
rmApplied associate-/r*0.1
rmApplied flip--0.1
Applied associate-/r/0.1
Applied associate-/l*0.1
Simplified0.1
Final simplification0.1
herbie shell --seed 2019174
(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))))