\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 r3200641 = 1.0;
double r3200642 = x;
double r3200643 = r3200641 - r3200642;
double r3200644 = log(r3200643);
double r3200645 = r3200641 + r3200642;
double r3200646 = log(r3200645);
double r3200647 = r3200644 / r3200646;
return r3200647;
}
double f(double x) {
double r3200648 = x;
double r3200649 = -r3200648;
double r3200650 = log1p(r3200649);
double r3200651 = log1p(r3200648);
double r3200652 = r3200650 / r3200651;
return r3200652;
}




Bits error versus x
Results
| Original | 60.9 |
|---|---|
| Target | 0.4 |
| Herbie | 0.0 |
Initial program 60.9
Simplified59.9
rmApplied sub-neg59.9
Applied log1p-def0.0
Final simplification0.0
herbie shell --seed 2019141 +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))))