\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 r3047863 = 1.0;
double r3047864 = x;
double r3047865 = r3047864 + r3047863;
double r3047866 = r3047863 / r3047865;
double r3047867 = 2.0;
double r3047868 = r3047867 / r3047864;
double r3047869 = r3047866 - r3047868;
double r3047870 = r3047864 - r3047863;
double r3047871 = r3047863 / r3047870;
double r3047872 = r3047869 + r3047871;
return r3047872;
}
double f(double x) {
double r3047873 = 2.0;
double r3047874 = x;
double r3047875 = 1.0;
double r3047876 = r3047874 + r3047875;
double r3047877 = r3047876 * r3047874;
double r3047878 = r3047873 / r3047877;
double r3047879 = r3047874 - r3047875;
double r3047880 = r3047878 / r3047879;
return r3047880;
}




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