\frac{\log \left(1 - x\right)}{\log \left(1 + x\right)}\mathsf{log1p}\left(\mathsf{expm1}\left(\frac{\mathsf{log1p}\left(-x\right)}{\mathsf{log1p}\left(x\right)}\right)\right)double f(double x) {
double r1467724 = 1.0;
double r1467725 = x;
double r1467726 = r1467724 - r1467725;
double r1467727 = log(r1467726);
double r1467728 = r1467724 + r1467725;
double r1467729 = log(r1467728);
double r1467730 = r1467727 / r1467729;
return r1467730;
}
double f(double x) {
double r1467731 = x;
double r1467732 = -r1467731;
double r1467733 = log1p(r1467732);
double r1467734 = log1p(r1467731);
double r1467735 = r1467733 / r1467734;
double r1467736 = expm1(r1467735);
double r1467737 = log1p(r1467736);
return r1467737;
}




Bits error versus x
Results
| Original | 61.1 |
|---|---|
| Target | 0.3 |
| Herbie | 0.0 |
Initial program 61.1
Simplified60.1
rmApplied log1p-expm1-u60.1
Simplified0.0
rmApplied log1p-expm1-u0.0
Final simplification0.0
herbie shell --seed 2019156 +o rules:numerics
(FPCore (x)
:name "qlog (example 3.10)"
:pre (and (< -1 x) (< x 1))
:herbie-target
(- (+ (+ (+ 1 x) (/ (* x x) 2)) (* 5/12 (pow x 3))))
(/ (log (- 1 x)) (log (+ 1 x))))