\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 r6853645 = 1.0;
double r6853646 = x;
double r6853647 = r6853646 + r6853645;
double r6853648 = r6853645 / r6853647;
double r6853649 = 2.0;
double r6853650 = r6853649 / r6853646;
double r6853651 = r6853648 - r6853650;
double r6853652 = r6853646 - r6853645;
double r6853653 = r6853645 / r6853652;
double r6853654 = r6853651 + r6853653;
return r6853654;
}
double f(double x) {
double r6853655 = 2.0;
double r6853656 = x;
double r6853657 = 1.0;
double r6853658 = r6853656 + r6853657;
double r6853659 = r6853658 * r6853656;
double r6853660 = r6853655 / r6853659;
double r6853661 = r6853656 - r6853657;
double r6853662 = r6853660 / r6853661;
return r6853662;
}




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