\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 r1242158 = 1.0;
double r1242159 = x;
double r1242160 = r1242158 - r1242159;
double r1242161 = log(r1242160);
double r1242162 = r1242158 + r1242159;
double r1242163 = log(r1242162);
double r1242164 = r1242161 / r1242163;
return r1242164;
}
double f(double x) {
double r1242165 = x;
double r1242166 = -r1242165;
double r1242167 = log1p(r1242166);
double r1242168 = log1p(r1242165);
double r1242169 = r1242167 / r1242168;
return r1242169;
}




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