\left(\frac{1}{x + 1} - \frac{2}{x}\right) + \frac{1}{x - 1}\frac{\frac{\frac{2}{1 + x}}{x - 1}}{x}double f(double x) {
double r81194 = 1.0;
double r81195 = x;
double r81196 = r81195 + r81194;
double r81197 = r81194 / r81196;
double r81198 = 2.0;
double r81199 = r81198 / r81195;
double r81200 = r81197 - r81199;
double r81201 = r81195 - r81194;
double r81202 = r81194 / r81201;
double r81203 = r81200 + r81202;
return r81203;
}
double f(double x) {
double r81204 = 2.0;
double r81205 = 1.0;
double r81206 = x;
double r81207 = r81205 + r81206;
double r81208 = r81204 / r81207;
double r81209 = r81206 - r81205;
double r81210 = r81208 / r81209;
double r81211 = r81210 / r81206;
return r81211;
}




Bits error versus x
Results
| Original | 10.0 |
|---|---|
| Target | 0.3 |
| Herbie | 0.1 |
Initial program 10.0
rmApplied frac-sub26.3
Applied frac-add26.1
Simplified26.1
Simplified26.1
Taylor expanded around 0 0.3
rmApplied associate-/r*0.1
Simplified0.1
Final simplification0.1
herbie shell --seed 2019196
(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))))