\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 r2973041 = 1.0;
double r2973042 = x;
double r2973043 = r2973042 + r2973041;
double r2973044 = r2973041 / r2973043;
double r2973045 = 2.0;
double r2973046 = r2973045 / r2973042;
double r2973047 = r2973044 - r2973046;
double r2973048 = r2973042 - r2973041;
double r2973049 = r2973041 / r2973048;
double r2973050 = r2973047 + r2973049;
return r2973050;
}
double f(double x) {
double r2973051 = 2.0;
double r2973052 = x;
double r2973053 = 1.0;
double r2973054 = r2973052 + r2973053;
double r2973055 = r2973054 * r2973052;
double r2973056 = r2973051 / r2973055;
double r2973057 = r2973052 - r2973053;
double r2973058 = r2973056 / r2973057;
return r2973058;
}




Bits error versus x
Results
| Original | 9.7 |
|---|---|
| Target | 0.3 |
| Herbie | 0.1 |
Initial program 9.7
rmApplied sub-neg9.7
Simplified9.7
rmApplied frac-add26.3
Applied frac-add25.6
Simplified25.6
Taylor expanded around 0 0.3
rmApplied associate-/r*0.1
Final simplification0.1
herbie shell --seed 2019163
(FPCore (x)
:name "3frac (problem 3.3.3)"
:herbie-target
(/ 2 (* x (- (* x x) 1)))
(+ (- (/ 1 (+ x 1)) (/ 2 x)) (/ 1 (- x 1))))