\left(\frac{1}{x + 1} - \frac{2}{x}\right) + \frac{1}{x - 1}\frac{\frac{1}{1 + x}}{x} \cdot \frac{2}{x - 1}double f(double x) {
double r6491828 = 1.0;
double r6491829 = x;
double r6491830 = r6491829 + r6491828;
double r6491831 = r6491828 / r6491830;
double r6491832 = 2.0;
double r6491833 = r6491832 / r6491829;
double r6491834 = r6491831 - r6491833;
double r6491835 = r6491829 - r6491828;
double r6491836 = r6491828 / r6491835;
double r6491837 = r6491834 + r6491836;
return r6491837;
}
double f(double x) {
double r6491838 = 1.0;
double r6491839 = 1.0;
double r6491840 = x;
double r6491841 = r6491839 + r6491840;
double r6491842 = r6491838 / r6491841;
double r6491843 = r6491842 / r6491840;
double r6491844 = 2.0;
double r6491845 = r6491840 - r6491839;
double r6491846 = r6491844 / r6491845;
double r6491847 = r6491843 * r6491846;
return r6491847;
}




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