\frac{\log \left(1 - x\right)}{\log \left(1 + x\right)}\frac{\log 1 - \mathsf{fma}\left(1, x, \frac{\frac{1}{2}}{1} \cdot \frac{{x}^{2}}{1}\right)}{\mathsf{fma}\left(\frac{-1}{2}, \frac{{x}^{2}}{{1}^{2}}, \mathsf{fma}\left(1, x, \log 1\right)\right)}double f(double x) {
double r102621 = 1.0;
double r102622 = x;
double r102623 = r102621 - r102622;
double r102624 = log(r102623);
double r102625 = r102621 + r102622;
double r102626 = log(r102625);
double r102627 = r102624 / r102626;
return r102627;
}
double f(double x) {
double r102628 = 1.0;
double r102629 = log(r102628);
double r102630 = x;
double r102631 = 0.5;
double r102632 = r102631 / r102628;
double r102633 = 2.0;
double r102634 = pow(r102630, r102633);
double r102635 = r102634 / r102628;
double r102636 = r102632 * r102635;
double r102637 = fma(r102628, r102630, r102636);
double r102638 = r102629 - r102637;
double r102639 = -0.5;
double r102640 = pow(r102628, r102633);
double r102641 = r102634 / r102640;
double r102642 = fma(r102628, r102630, r102629);
double r102643 = fma(r102639, r102641, r102642);
double r102644 = r102638 / r102643;
return r102644;
}




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 unpow20.4
Applied *-un-lft-identity0.4
Applied unpow-prod-down0.4
Applied times-frac0.4
Applied associate-*r*0.4
Simplified0.4
Final simplification0.4
herbie shell --seed 2019351 +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))))