double code(double x) {
return ((double) (((double) (((double) (1.0 / ((double) (x + 1.0)))) - ((double) (2.0 / x)))) + ((double) (1.0 / ((double) (x - 1.0))))));
}
double code(double x) {
return ((double) (((double) (2.0 / x)) / ((double) (((double) (x * x)) - ((double) (1.0 * 1.0))))));
}




Bits error versus x
Results
| Original | 10.1 |
|---|---|
| Target | 0.3 |
| Herbie | 0.1 |
Initial program 10.1
rmApplied frac-sub25.8
Applied frac-add25.4
Simplified25.4
Simplified25.4
Taylor expanded around 0 0.3
rmApplied associate-/r*0.1
Final simplification0.1
herbie shell --seed 2020191
(FPCore (x)
:name "3frac (problem 3.3.3)"
:precision binary64
:herbie-target
(/ 2.0 (* x (- (* x x) 1.0)))
(+ (- (/ 1.0 (+ x 1.0)) (/ 2.0 x)) (/ 1.0 (- x 1.0))))