\frac{\log \left(1 - x\right)}{\log \left(1 + x\right)}\frac{1}{\frac{\mathsf{log1p}\left(x\right)}{\mathsf{log1p}\left(\left(-x\right)\right)}}double f(double x) {
double r7854286 = 1.0;
double r7854287 = x;
double r7854288 = r7854286 - r7854287;
double r7854289 = log(r7854288);
double r7854290 = r7854286 + r7854287;
double r7854291 = log(r7854290);
double r7854292 = r7854289 / r7854291;
return r7854292;
}
double f(double x) {
double r7854293 = 1.0;
double r7854294 = x;
double r7854295 = log1p(r7854294);
double r7854296 = -r7854294;
double r7854297 = log1p(r7854296);
double r7854298 = r7854295 / r7854297;
double r7854299 = r7854293 / r7854298;
return r7854299;
}




Bits error versus x
Results
| Original | 60.8 |
|---|---|
| Target | 0.4 |
| Herbie | 0.0 |
Initial program 60.8
Simplified59.9
rmApplied log1p-expm1-u59.9
Simplified0.0
rmApplied clear-num0.0
Final simplification0.0
herbie shell --seed 2019125 +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))))