\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 r3893651 = 1.0;
double r3893652 = x;
double r3893653 = r3893652 + r3893651;
double r3893654 = r3893651 / r3893653;
double r3893655 = r3893651 / r3893652;
double r3893656 = r3893654 - r3893655;
return r3893656;
}
double f(double x) {
double r3893657 = 1.0;
double r3893658 = -r3893657;
double r3893659 = x;
double r3893660 = r3893659 + r3893657;
double r3893661 = r3893658 / r3893660;
double r3893662 = expm1(r3893661);
double r3893663 = log1p(r3893662);
double r3893664 = r3893663 / r3893659;
return r3893664;
}



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)))