\frac{\log \left(1 - x\right)}{\log \left(1 + x\right)}\sqrt[3]{{\left(\frac{\log 1 - \mathsf{fma}\left(1, x, \frac{1}{2} \cdot \frac{{x}^{2}}{{1}^{2}}\right)}{\mathsf{fma}\left(1, x, \log 1\right) - \frac{1}{2} \cdot \frac{{x}^{2}}{{1}^{2}}}\right)}^{3}}double f(double x) {
double r77577 = 1.0;
double r77578 = x;
double r77579 = r77577 - r77578;
double r77580 = log(r77579);
double r77581 = r77577 + r77578;
double r77582 = log(r77581);
double r77583 = r77580 / r77582;
return r77583;
}
double f(double x) {
double r77584 = 1.0;
double r77585 = log(r77584);
double r77586 = x;
double r77587 = 0.5;
double r77588 = 2.0;
double r77589 = pow(r77586, r77588);
double r77590 = pow(r77584, r77588);
double r77591 = r77589 / r77590;
double r77592 = r77587 * r77591;
double r77593 = fma(r77584, r77586, r77592);
double r77594 = r77585 - r77593;
double r77595 = fma(r77584, r77586, r77585);
double r77596 = r77595 - r77592;
double r77597 = r77594 / r77596;
double r77598 = 3.0;
double r77599 = pow(r77597, r77598);
double r77600 = cbrt(r77599);
return r77600;
}




Bits error versus x
| Original | 61.4 |
|---|---|
| Target | 0.3 |
| Herbie | 0.4 |
Initial program 61.4
Taylor expanded around 0 60.5
Simplified60.5
Taylor expanded around 0 0.4
Simplified0.4
rmApplied add-cbrt-cube42.4
Applied add-cbrt-cube41.8
Applied cbrt-undiv41.8
Simplified0.4
Final simplification0.4
herbie shell --seed 2020043 +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))))