\left(\frac{1}{x + 1} - \frac{2}{x}\right) + \frac{1}{x - 1}\frac{\frac{\frac{2}{x + 1}}{x}}{x - 1}double f(double x) {
double r83234 = 1.0;
double r83235 = x;
double r83236 = r83235 + r83234;
double r83237 = r83234 / r83236;
double r83238 = 2.0;
double r83239 = r83238 / r83235;
double r83240 = r83237 - r83239;
double r83241 = r83235 - r83234;
double r83242 = r83234 / r83241;
double r83243 = r83240 + r83242;
return r83243;
}
double f(double x) {
double r83244 = 2.0;
double r83245 = x;
double r83246 = 1.0;
double r83247 = r83245 + r83246;
double r83248 = r83244 / r83247;
double r83249 = r83248 / r83245;
double r83250 = r83245 - r83246;
double r83251 = r83249 / r83250;
return r83251;
}




Bits error versus x
Results
| Original | 9.9 |
|---|---|
| Target | 0.3 |
| Herbie | 0.1 |
Initial program 9.9
rmApplied frac-sub26.1
Applied frac-add25.8
Taylor expanded around 0 0.3
rmApplied associate-/r*0.1
rmApplied associate-/r*0.1
Final simplification0.1
herbie shell --seed 2019323
(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))))