\frac{\log \left(1 - x\right)}{\log \left(1 + x\right)}\frac{\frac{1}{\mathsf{fma}\left(x, 1, \log 1 - \frac{1}{2} \cdot \frac{{x}^{2}}{{1}^{2}}\right)}}{\frac{1}{\log 1 - \mathsf{fma}\left(1, x, \frac{1}{2} \cdot \frac{{x}^{2}}{{1}^{2}}\right)}}double f(double x) {
double r86896 = 1.0;
double r86897 = x;
double r86898 = r86896 - r86897;
double r86899 = log(r86898);
double r86900 = r86896 + r86897;
double r86901 = log(r86900);
double r86902 = r86899 / r86901;
return r86902;
}
double f(double x) {
double r86903 = 1.0;
double r86904 = x;
double r86905 = 1.0;
double r86906 = log(r86905);
double r86907 = 0.5;
double r86908 = 2.0;
double r86909 = pow(r86904, r86908);
double r86910 = pow(r86905, r86908);
double r86911 = r86909 / r86910;
double r86912 = r86907 * r86911;
double r86913 = r86906 - r86912;
double r86914 = fma(r86904, r86905, r86913);
double r86915 = r86903 / r86914;
double r86916 = fma(r86905, r86904, r86912);
double r86917 = r86906 - r86916;
double r86918 = r86903 / r86917;
double r86919 = r86915 / r86918;
return r86919;
}




Bits error versus x
| Original | 61.3 |
|---|---|
| Target | 0.3 |
| Herbie | 0.4 |
Initial program 61.3
Taylor expanded around 0 60.4
Simplified60.4
Taylor expanded around 0 0.4
Simplified0.4
rmApplied clear-num0.4
rmApplied div-inv0.6
Applied associate-/r*0.4
Final simplification0.4
herbie shell --seed 2020027 +o rules:numerics
(FPCore (x)
:name "qlog (example 3.10)"
:precision binary64
:pre (and (< -1 x) (< x 1))
:herbie-target
(- (+ (+ (+ 1 x) (/ (* x x) 2)) (* 0.4166666666666667 (pow x 3))))
(/ (log (- 1 x)) (log (+ 1 x))))