\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 r2008241 = 1.0;
double r2008242 = x;
double r2008243 = r2008242 + r2008241;
double r2008244 = r2008241 / r2008243;
double r2008245 = 2.0;
double r2008246 = r2008245 / r2008242;
double r2008247 = r2008244 - r2008246;
double r2008248 = r2008242 - r2008241;
double r2008249 = r2008241 / r2008248;
double r2008250 = r2008247 + r2008249;
return r2008250;
}
double f(double x) {
double r2008251 = 1.0;
double r2008252 = x;
double r2008253 = r2008252 + r2008251;
double r2008254 = r2008251 / r2008253;
double r2008255 = r2008254 / r2008252;
double r2008256 = 2.0;
double r2008257 = -1.0;
double r2008258 = r2008252 + r2008257;
double r2008259 = r2008256 / r2008258;
double r2008260 = r2008255 * r2008259;
return r2008260;
}




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 0 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))))