\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 r2672753 = 1.0;
double r2672754 = x;
double r2672755 = r2672753 - r2672754;
double r2672756 = log(r2672755);
double r2672757 = r2672753 + r2672754;
double r2672758 = log(r2672757);
double r2672759 = r2672756 / r2672758;
return r2672759;
}
double f(double x) {
double r2672760 = x;
double r2672761 = -r2672760;
double r2672762 = log1p(r2672761);
double r2672763 = log1p(r2672760);
double r2672764 = r2672762 / r2672763;
return r2672764;
}




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