\left(\frac{1}{x + 1} - \frac{2}{x}\right) + \frac{1}{x - 1}\frac{2}{\left(\left(x + 1\right) \cdot x\right) \cdot \left(x - 1\right)}double f(double x) {
double r1691119 = 1.0;
double r1691120 = x;
double r1691121 = r1691120 + r1691119;
double r1691122 = r1691119 / r1691121;
double r1691123 = 2.0;
double r1691124 = r1691123 / r1691120;
double r1691125 = r1691122 - r1691124;
double r1691126 = r1691120 - r1691119;
double r1691127 = r1691119 / r1691126;
double r1691128 = r1691125 + r1691127;
return r1691128;
}
double f(double x) {
double r1691129 = 2.0;
double r1691130 = x;
double r1691131 = 1.0;
double r1691132 = r1691130 + r1691131;
double r1691133 = r1691132 * r1691130;
double r1691134 = r1691130 - r1691131;
double r1691135 = r1691133 * r1691134;
double r1691136 = r1691129 / r1691135;
return r1691136;
}




Bits error versus x
Results
| Original | 9.6 |
|---|---|
| Target | 0.3 |
| Herbie | 0.3 |
Initial program 9.6
rmApplied add-cube-cbrt24.3
Applied *-un-lft-identity24.3
Applied times-frac25.2
rmApplied frac-times24.3
Applied frac-sub28.7
Applied frac-add25.5
Simplified25.2
Simplified25.1
Taylor expanded around 0 0.3
Final simplification0.3
herbie shell --seed 2019154
(FPCore (x)
:name "3frac (problem 3.3.3)"
:herbie-target
(/ 2 (* x (- (* x x) 1)))
(+ (- (/ 1 (+ x 1)) (/ 2 x)) (/ 1 (- x 1))))