\frac{\log \left(1 - x\right)}{\log \left(1 + x\right)}\sqrt[3]{\mathsf{log1p}\left(\mathsf{expm1}\left({\left(\frac{\log 1 - \mathsf{fma}\left(1, x, \frac{1}{2} \cdot \frac{{x}^{2}}{{1}^{2}}\right)}{\mathsf{fma}\left(\frac{{x}^{2}}{{1}^{2}}, \frac{-1}{2}, \mathsf{fma}\left(1, x, \log 1\right)\right)}\right)}^{3}\right)\right)}double f(double x) {
double r83183 = 1.0;
double r83184 = x;
double r83185 = r83183 - r83184;
double r83186 = log(r83185);
double r83187 = r83183 + r83184;
double r83188 = log(r83187);
double r83189 = r83186 / r83188;
return r83189;
}
double f(double x) {
double r83190 = 1.0;
double r83191 = log(r83190);
double r83192 = x;
double r83193 = 0.5;
double r83194 = 2.0;
double r83195 = pow(r83192, r83194);
double r83196 = pow(r83190, r83194);
double r83197 = r83195 / r83196;
double r83198 = r83193 * r83197;
double r83199 = fma(r83190, r83192, r83198);
double r83200 = r83191 - r83199;
double r83201 = -0.5;
double r83202 = fma(r83190, r83192, r83191);
double r83203 = fma(r83197, r83201, r83202);
double r83204 = r83200 / r83203;
double r83205 = 3.0;
double r83206 = pow(r83204, r83205);
double r83207 = expm1(r83206);
double r83208 = log1p(r83207);
double r83209 = cbrt(r83208);
return r83209;
}




Bits error versus x
| Original | 61.5 |
|---|---|
| Target | 0.3 |
| Herbie | 0.4 |
Initial program 61.5
Taylor expanded around 0 60.6
Simplified60.6
Taylor expanded around 0 0.4
Simplified0.4
rmApplied add-cbrt-cube42.8
Applied add-cbrt-cube42.2
Applied cbrt-undiv42.2
Simplified0.4
rmApplied log1p-expm1-u0.4
Final simplification0.4
herbie shell --seed 2019195 +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))))