\left(\frac{1}{x + 1} - \frac{2}{x}\right) + \frac{1}{x - 1}\frac{\frac{1}{x + 1}}{x} \cdot \frac{2}{x + -1}double f(double x) {
double r1133751 = 1.0;
double r1133752 = x;
double r1133753 = r1133752 + r1133751;
double r1133754 = r1133751 / r1133753;
double r1133755 = 2.0;
double r1133756 = r1133755 / r1133752;
double r1133757 = r1133754 - r1133756;
double r1133758 = r1133752 - r1133751;
double r1133759 = r1133751 / r1133758;
double r1133760 = r1133757 + r1133759;
return r1133760;
}
double f(double x) {
double r1133761 = 1.0;
double r1133762 = x;
double r1133763 = r1133762 + r1133761;
double r1133764 = r1133761 / r1133763;
double r1133765 = r1133764 / r1133762;
double r1133766 = 2.0;
double r1133767 = -1.0;
double r1133768 = r1133762 + r1133767;
double r1133769 = r1133766 / r1133768;
double r1133770 = r1133765 * r1133769;
return r1133770;
}




Bits error versus x
Results
| Original | 10.2 |
|---|---|
| Target | 0.3 |
| Herbie | 0.1 |
Initial program 10.2
rmApplied frac-sub26.4
Applied frac-add25.8
Simplified25.8
Simplified25.8
Taylor expanded around inf 0.3
rmApplied *-un-lft-identity0.3
Applied times-frac0.1
rmApplied associate-/r*0.1
Final simplification0.1
herbie shell --seed 2019153
(FPCore (x)
:name "3frac (problem 3.3.3)"
:herbie-target
(/ 2 (* x (- (* x x) 1)))
(+ (- (/ 1 (+ x 1)) (/ 2 x)) (/ 1 (- x 1))))