\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 r3671321 = 1.0;
double r3671322 = x;
double r3671323 = r3671322 + r3671321;
double r3671324 = r3671321 / r3671323;
double r3671325 = 2.0;
double r3671326 = r3671325 / r3671322;
double r3671327 = r3671324 - r3671326;
double r3671328 = r3671322 - r3671321;
double r3671329 = r3671321 / r3671328;
double r3671330 = r3671327 + r3671329;
return r3671330;
}
double f(double x) {
double r3671331 = 2.0;
double r3671332 = x;
double r3671333 = 1.0;
double r3671334 = r3671332 + r3671333;
double r3671335 = r3671334 * r3671332;
double r3671336 = r3671331 / r3671335;
double r3671337 = r3671332 - r3671333;
double r3671338 = r3671336 / r3671337;
return r3671338;
}




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