\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 r140258 = 1.0;
double r140259 = x;
double r140260 = r140259 + r140258;
double r140261 = r140258 / r140260;
double r140262 = 2.0;
double r140263 = r140262 / r140259;
double r140264 = r140261 - r140263;
double r140265 = r140259 - r140258;
double r140266 = r140258 / r140265;
double r140267 = r140264 + r140266;
return r140267;
}
double f(double x) {
double r140268 = 2.0;
double r140269 = x;
double r140270 = 1.0;
double r140271 = r140269 + r140270;
double r140272 = r140271 * r140269;
double r140273 = r140268 / r140272;
double r140274 = r140269 - r140270;
double r140275 = r140273 / r140274;
return r140275;
}




Bits error versus x
Results
| Original | 10.2 |
|---|---|
| Target | 0.3 |
| Herbie | 0.1 |
Initial program 10.2
rmApplied *-un-lft-identity10.2
Applied add-sqr-sqrt10.2
Applied times-frac10.2
Simplified10.2
rmApplied associate-*r/10.2
Applied frac-sub26.6
Applied frac-add26.1
Simplified26.1
Taylor expanded around 0 0.3
rmApplied associate-/r*0.1
Final simplification0.1
herbie shell --seed 2020025
(FPCore (x)
:name "3frac (problem 3.3.3)"
:precision binary64
:herbie-target
(/ 2 (* x (- (* x x) 1)))
(+ (- (/ 1 (+ x 1)) (/ 2 x)) (/ 1 (- x 1))))