\left(\frac{1}{x + 1} - \frac{2}{x}\right) + \frac{1}{x - 1}\frac{\frac{2}{x \cdot x - 1 \cdot 1}}{x}double f(double x) {
double r95623 = 1.0;
double r95624 = x;
double r95625 = r95624 + r95623;
double r95626 = r95623 / r95625;
double r95627 = 2.0;
double r95628 = r95627 / r95624;
double r95629 = r95626 - r95628;
double r95630 = r95624 - r95623;
double r95631 = r95623 / r95630;
double r95632 = r95629 + r95631;
return r95632;
}
double f(double x) {
double r95633 = 2.0;
double r95634 = x;
double r95635 = r95634 * r95634;
double r95636 = 1.0;
double r95637 = r95636 * r95636;
double r95638 = r95635 - r95637;
double r95639 = r95633 / r95638;
double r95640 = r95639 / r95634;
return r95640;
}




Bits error versus x
Results
| Original | 9.7 |
|---|---|
| Target | 0.3 |
| Herbie | 0.1 |
Initial program 9.7
Simplified9.7
rmApplied frac-sub26.0
Applied frac-sub25.6
Taylor expanded around 0 0.3
rmApplied associate-/r*0.1
rmApplied flip--0.1
Applied associate-/r/0.1
Applied times-frac0.1
Simplified0.1
Final simplification0.1
herbie shell --seed 2019305
(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))))