\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 r1554510 = 1.0;
double r1554511 = x;
double r1554512 = r1554510 - r1554511;
double r1554513 = log(r1554512);
double r1554514 = r1554510 + r1554511;
double r1554515 = log(r1554514);
double r1554516 = r1554513 / r1554515;
return r1554516;
}
double f(double x) {
double r1554517 = 1.0;
double r1554518 = x;
double r1554519 = log1p(r1554518);
double r1554520 = -r1554518;
double r1554521 = log1p(r1554520);
double r1554522 = r1554519 / r1554521;
double r1554523 = r1554517 / r1554522;
return r1554523;
}




Bits error versus x
Results
| Original | 61.1 |
|---|---|
| Target | 0.3 |
| Herbie | 0.0 |
Initial program 61.1
Simplified60.2
rmApplied log1p-expm1-u60.2
Simplified0.0
rmApplied clear-num0.0
Final simplification0.0
herbie shell --seed 2019155 +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))))