\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 r1826202 = 1.0;
double r1826203 = x;
double r1826204 = r1826203 + r1826202;
double r1826205 = r1826202 / r1826204;
double r1826206 = 2.0;
double r1826207 = r1826206 / r1826203;
double r1826208 = r1826205 - r1826207;
double r1826209 = r1826203 - r1826202;
double r1826210 = r1826202 / r1826209;
double r1826211 = r1826208 + r1826210;
return r1826211;
}
double f(double x) {
double r1826212 = 2.0;
double r1826213 = x;
double r1826214 = 1.0;
double r1826215 = r1826213 + r1826214;
double r1826216 = r1826215 * r1826213;
double r1826217 = r1826212 / r1826216;
double r1826218 = r1826213 - r1826214;
double r1826219 = r1826217 / r1826218;
return r1826219;
}




Bits error versus x
Results
| Original | 10.0 |
|---|---|
| Target | 0.3 |
| Herbie | 0.1 |
Initial program 10.0
rmApplied frac-sub26.3
Applied frac-add25.6
Simplified26.1
Simplified26.1
Taylor expanded around 0 0.3
rmApplied associate-/r*0.1
Final simplification0.1
herbie shell --seed 2019155 +o rules:numerics
(FPCore (x)
:name "3frac (problem 3.3.3)"
:herbie-target
(/ 2 (* x (- (* x x) 1)))
(+ (- (/ 1 (+ x 1)) (/ 2 x)) (/ 1 (- x 1))))