\frac{\log \left(1 - x\right)}{\log \left(1 + x\right)}\frac{\mathsf{log1p}\left(-x\right)}{\mathsf{log1p}\left(x\right)}double f(double x) {
double r1666549 = 1.0;
double r1666550 = x;
double r1666551 = r1666549 - r1666550;
double r1666552 = log(r1666551);
double r1666553 = r1666549 + r1666550;
double r1666554 = log(r1666553);
double r1666555 = r1666552 / r1666554;
return r1666555;
}
double f(double x) {
double r1666556 = x;
double r1666557 = -r1666556;
double r1666558 = log1p(r1666557);
double r1666559 = log1p(r1666556);
double r1666560 = r1666558 / r1666559;
return r1666560;
}




Bits error versus x
Results
| Original | 61.0 |
|---|---|
| Target | 0.3 |
| Herbie | 0.0 |
Initial program 61.0
Simplified60.1
rmApplied sub-neg60.1
Applied log1p-def0.0
Final simplification0.0
herbie shell --seed 2019151 +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))))