\frac{1}{x + 1} - \frac{1}{x}\frac{\mathsf{log1p}\left(\mathsf{expm1}\left(\frac{-1}{x + 1}\right)\right)}{x}double f(double x) {
double r3052847 = 1.0;
double r3052848 = x;
double r3052849 = r3052848 + r3052847;
double r3052850 = r3052847 / r3052849;
double r3052851 = r3052847 / r3052848;
double r3052852 = r3052850 - r3052851;
return r3052852;
}
double f(double x) {
double r3052853 = 1.0;
double r3052854 = -r3052853;
double r3052855 = x;
double r3052856 = r3052855 + r3052853;
double r3052857 = r3052854 / r3052856;
double r3052858 = expm1(r3052857);
double r3052859 = log1p(r3052858);
double r3052860 = r3052859 / r3052855;
return r3052860;
}



Bits error versus x
Results
Initial program 14.8
rmApplied frac-sub14.1
Taylor expanded around 0 0.4
rmApplied associate-/r*0.1
rmApplied log1p-expm1-u0.1
Final simplification0.1
herbie shell --seed 2019200 +o rules:numerics
(FPCore (x)
:name "2frac (problem 3.3.1)"
(- (/ 1.0 (+ x 1.0)) (/ 1.0 x)))