\frac{\log \left(1 - x\right)}{\log \left(1 + x\right)}\frac{\frac{1}{\mathsf{fma}\left(\frac{-1}{2}, \frac{{x}^{2}}{{1}^{2}}, \mathsf{fma}\left(1, x, \log 1\right)\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 r65369 = 1.0;
double r65370 = x;
double r65371 = r65369 - r65370;
double r65372 = log(r65371);
double r65373 = r65369 + r65370;
double r65374 = log(r65373);
double r65375 = r65372 / r65374;
return r65375;
}
double f(double x) {
double r65376 = 1.0;
double r65377 = -0.5;
double r65378 = x;
double r65379 = 2.0;
double r65380 = pow(r65378, r65379);
double r65381 = 1.0;
double r65382 = pow(r65381, r65379);
double r65383 = r65380 / r65382;
double r65384 = log(r65381);
double r65385 = fma(r65381, r65378, r65384);
double r65386 = fma(r65377, r65383, r65385);
double r65387 = r65376 / r65386;
double r65388 = 0.5;
double r65389 = r65388 * r65383;
double r65390 = fma(r65381, r65378, r65389);
double r65391 = r65384 - r65390;
double r65392 = r65376 / r65391;
double r65393 = r65387 / r65392;
return r65393;
}




Bits error versus x
| Original | 61.3 |
|---|---|
| Target | 0.3 |
| Herbie | 0.5 |
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.5
Final simplification0.5
herbie shell --seed 2019303 +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.416666666666666685 (pow x 3))))
(/ (log (- 1 x)) (log (+ 1 x))))