\frac{\log \left(1 - x\right)}{\log \left(1 + x\right)}\frac{1}{\frac{\mathsf{log1p}\left(x\right)}{\mathsf{log1p}\left(-x\right)}}double f(double x) {
double r2084254 = 1.0;
double r2084255 = x;
double r2084256 = r2084254 - r2084255;
double r2084257 = log(r2084256);
double r2084258 = r2084254 + r2084255;
double r2084259 = log(r2084258);
double r2084260 = r2084257 / r2084259;
return r2084260;
}
double f(double x) {
double r2084261 = 1.0;
double r2084262 = x;
double r2084263 = log1p(r2084262);
double r2084264 = -r2084262;
double r2084265 = log1p(r2084264);
double r2084266 = r2084263 / r2084265;
double r2084267 = r2084261 / r2084266;
return r2084267;
}




Bits error versus x
Results
| Original | 61.0 |
|---|---|
| Target | 0.4 |
| Herbie | 0.0 |
Initial program 61.0
Simplified60.0
rmApplied sub-neg60.0
Applied log1p-def0.0
rmApplied *-un-lft-identity0.0
Applied associate-/l*0.0
Final simplification0.0
herbie shell --seed 2019144 +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))))