\left(\frac{1}{x + 1} - \frac{2}{x}\right) + \frac{1}{x - 1}\frac{\frac{1}{1 + x}}{x} \cdot \frac{2}{x - 1}double f(double x) {
double r82122 = 1.0;
double r82123 = x;
double r82124 = r82123 + r82122;
double r82125 = r82122 / r82124;
double r82126 = 2.0;
double r82127 = r82126 / r82123;
double r82128 = r82125 - r82127;
double r82129 = r82123 - r82122;
double r82130 = r82122 / r82129;
double r82131 = r82128 + r82130;
return r82131;
}
double f(double x) {
double r82132 = 1.0;
double r82133 = 1.0;
double r82134 = x;
double r82135 = r82133 + r82134;
double r82136 = r82132 / r82135;
double r82137 = r82136 / r82134;
double r82138 = 2.0;
double r82139 = r82134 - r82133;
double r82140 = r82138 / r82139;
double r82141 = r82137 * r82140;
return r82141;
}




Bits error versus x
Results
| Original | 9.9 |
|---|---|
| Target | 0.3 |
| Herbie | 0.1 |
Initial program 9.9
rmApplied frac-sub26.1
Applied frac-add25.8
Taylor expanded around 0 0.3
rmApplied *-un-lft-identity0.3
Applied times-frac0.1
rmApplied associate-/r*0.1
Simplified0.1
Final simplification0.1
herbie shell --seed 2019323
(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))))