\left(\frac{1}{x + 1} - \frac{2}{x}\right) + \frac{1}{x - 1}\frac{\frac{2}{x \cdot x - 1}}{x}double f(double x) {
double r1885809 = 1.0;
double r1885810 = x;
double r1885811 = r1885810 + r1885809;
double r1885812 = r1885809 / r1885811;
double r1885813 = 2.0;
double r1885814 = r1885813 / r1885810;
double r1885815 = r1885812 - r1885814;
double r1885816 = r1885810 - r1885809;
double r1885817 = r1885809 / r1885816;
double r1885818 = r1885815 + r1885817;
return r1885818;
}
double f(double x) {
double r1885819 = 2.0;
double r1885820 = x;
double r1885821 = r1885820 * r1885820;
double r1885822 = 1.0;
double r1885823 = r1885821 - r1885822;
double r1885824 = r1885819 / r1885823;
double r1885825 = r1885824 / r1885820;
return r1885825;
}




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