\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 r3492517 = 1.0;
double r3492518 = x;
double r3492519 = r3492518 + r3492517;
double r3492520 = r3492517 / r3492519;
double r3492521 = 2.0;
double r3492522 = r3492521 / r3492518;
double r3492523 = r3492520 - r3492522;
double r3492524 = r3492518 - r3492517;
double r3492525 = r3492517 / r3492524;
double r3492526 = r3492523 + r3492525;
return r3492526;
}
double f(double x) {
double r3492527 = 2.0;
double r3492528 = x;
double r3492529 = 1.0;
double r3492530 = r3492528 + r3492529;
double r3492531 = r3492527 / r3492530;
double r3492532 = r3492531 / r3492528;
double r3492533 = r3492528 - r3492529;
double r3492534 = r3492532 / r3492533;
return r3492534;
}




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