\left(\frac{1}{x + 1} - \frac{2}{x}\right) + \frac{1}{x - 1}\frac{\frac{2}{x \cdot \left(x + 1\right)}}{x - 1}double f(double x) {
double r116247 = 1.0;
double r116248 = x;
double r116249 = r116248 + r116247;
double r116250 = r116247 / r116249;
double r116251 = 2.0;
double r116252 = r116251 / r116248;
double r116253 = r116250 - r116252;
double r116254 = r116248 - r116247;
double r116255 = r116247 / r116254;
double r116256 = r116253 + r116255;
return r116256;
}
double f(double x) {
double r116257 = 2.0;
double r116258 = x;
double r116259 = 1.0;
double r116260 = r116258 + r116259;
double r116261 = r116258 * r116260;
double r116262 = r116257 / r116261;
double r116263 = r116258 - r116259;
double r116264 = r116262 / r116263;
return r116264;
}




Bits error versus x
Results
| Original | 10.0 |
|---|---|
| Target | 0.3 |
| Herbie | 0.1 |
Initial program 10.0
Simplified10.0
rmApplied frac-sub26.0
Applied frac-sub25.4
Taylor expanded around 0 0.3
rmApplied *-un-lft-identity0.3
Applied times-frac0.1
rmApplied *-un-lft-identity0.1
Applied add-sqr-sqrt0.1
Applied times-frac0.1
Applied associate-*l*0.1
Simplified0.1
Final simplification0.1
herbie shell --seed 2019198
(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))))