\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 r5115410 = 1.0;
double r5115411 = x;
double r5115412 = r5115411 + r5115410;
double r5115413 = r5115410 / r5115412;
double r5115414 = 2.0;
double r5115415 = r5115414 / r5115411;
double r5115416 = r5115413 - r5115415;
double r5115417 = r5115411 - r5115410;
double r5115418 = r5115410 / r5115417;
double r5115419 = r5115416 + r5115418;
return r5115419;
}
double f(double x) {
double r5115420 = 2.0;
double r5115421 = x;
double r5115422 = 1.0;
double r5115423 = r5115421 + r5115422;
double r5115424 = r5115423 * r5115421;
double r5115425 = r5115420 / r5115424;
double r5115426 = r5115421 - r5115422;
double r5115427 = r5115425 / r5115426;
return r5115427;
}




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