\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 r4707148 = 1.0;
double r4707149 = x;
double r4707150 = r4707149 + r4707148;
double r4707151 = r4707148 / r4707150;
double r4707152 = 2.0;
double r4707153 = r4707152 / r4707149;
double r4707154 = r4707151 - r4707153;
double r4707155 = r4707149 - r4707148;
double r4707156 = r4707148 / r4707155;
double r4707157 = r4707154 + r4707156;
return r4707157;
}
double f(double x) {
double r4707158 = 2.0;
double r4707159 = x;
double r4707160 = 1.0;
double r4707161 = r4707159 + r4707160;
double r4707162 = r4707161 * r4707159;
double r4707163 = r4707158 / r4707162;
double r4707164 = r4707159 - r4707160;
double r4707165 = r4707163 / r4707164;
return r4707165;
}




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