\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 r1118825 = 1.0;
double r1118826 = x;
double r1118827 = r1118825 - r1118826;
double r1118828 = log(r1118827);
double r1118829 = r1118825 + r1118826;
double r1118830 = log(r1118829);
double r1118831 = r1118828 / r1118830;
return r1118831;
}
double f(double x) {
double r1118832 = 1.0;
double r1118833 = x;
double r1118834 = log1p(r1118833);
double r1118835 = -r1118833;
double r1118836 = log1p(r1118835);
double r1118837 = r1118834 / r1118836;
double r1118838 = r1118832 / r1118837;
return r1118838;
}




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