\frac{\log \left(1 - x\right)}{\log \left(1 + x\right)}\sqrt[3]{{\left(\mathsf{log1p}\left(\mathsf{expm1}\left(\frac{\log 1 - \mathsf{fma}\left(1, x, \frac{1}{2} \cdot \frac{{x}^{2}}{{1}^{2}}\right)}{\mathsf{fma}\left(\frac{-1}{2}, \frac{{x}^{2}}{{1}^{2}}, \mathsf{fma}\left(1, x, \log 1\right)\right)}\right)\right)\right)}^{3}}double f(double x) {
double r80604 = 1.0;
double r80605 = x;
double r80606 = r80604 - r80605;
double r80607 = log(r80606);
double r80608 = r80604 + r80605;
double r80609 = log(r80608);
double r80610 = r80607 / r80609;
return r80610;
}
double f(double x) {
double r80611 = 1.0;
double r80612 = log(r80611);
double r80613 = x;
double r80614 = 0.5;
double r80615 = 2.0;
double r80616 = pow(r80613, r80615);
double r80617 = pow(r80611, r80615);
double r80618 = r80616 / r80617;
double r80619 = r80614 * r80618;
double r80620 = fma(r80611, r80613, r80619);
double r80621 = r80612 - r80620;
double r80622 = -0.5;
double r80623 = fma(r80611, r80613, r80612);
double r80624 = fma(r80622, r80618, r80623);
double r80625 = r80621 / r80624;
double r80626 = expm1(r80625);
double r80627 = log1p(r80626);
double r80628 = 3.0;
double r80629 = pow(r80627, r80628);
double r80630 = cbrt(r80629);
return r80630;
}




Bits error versus x
| Original | 61.6 |
|---|---|
| Target | 0.3 |
| Herbie | 0.4 |
Initial program 61.6
Taylor expanded around 0 60.6
Simplified60.6
Taylor expanded around 0 0.4
Simplified0.4
rmApplied add-cbrt-cube42.9
Applied add-cbrt-cube42.3
Applied cbrt-undiv42.2
Simplified0.4
rmApplied log1p-expm1-u0.4
Final simplification0.4
herbie shell --seed 2019198 +o rules:numerics
(FPCore (x)
:name "qlog (example 3.10)"
:pre (and (< -1.0 x) (< x 1.0))
:herbie-target
(- (+ (+ (+ 1.0 x) (/ (* x x) 2.0)) (* 0.4166666666666667 (pow x 3.0))))
(/ (log (- 1.0 x)) (log (+ 1.0 x))))