\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 r9846329 = 1.0;
double r9846330 = x;
double r9846331 = r9846330 + r9846329;
double r9846332 = r9846329 / r9846331;
double r9846333 = 2.0;
double r9846334 = r9846333 / r9846330;
double r9846335 = r9846332 - r9846334;
double r9846336 = r9846330 - r9846329;
double r9846337 = r9846329 / r9846336;
double r9846338 = r9846335 + r9846337;
return r9846338;
}
double f(double x) {
double r9846339 = 2.0;
double r9846340 = x;
double r9846341 = 1.0;
double r9846342 = r9846340 + r9846341;
double r9846343 = r9846342 * r9846340;
double r9846344 = r9846339 / r9846343;
double r9846345 = r9846340 - r9846341;
double r9846346 = r9846344 / r9846345;
return r9846346;
}




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