\frac{\log \left(1 - x\right)}{\log \left(1 + x\right)}\frac{\frac{1}{\left(\log 1 + x \cdot 1\right) - \frac{1}{2} \cdot \left(\frac{x}{1} \cdot \frac{x}{1}\right)}}{\frac{1}{\log 1 - \left(x \cdot 1 + \frac{1}{2} \cdot \left(\frac{x}{1} \cdot \frac{x}{1}\right)\right)}}double f(double x) {
double r4050434 = 1.0;
double r4050435 = x;
double r4050436 = r4050434 - r4050435;
double r4050437 = log(r4050436);
double r4050438 = r4050434 + r4050435;
double r4050439 = log(r4050438);
double r4050440 = r4050437 / r4050439;
return r4050440;
}
double f(double x) {
double r4050441 = 1.0;
double r4050442 = 1.0;
double r4050443 = log(r4050442);
double r4050444 = x;
double r4050445 = r4050444 * r4050442;
double r4050446 = r4050443 + r4050445;
double r4050447 = 0.5;
double r4050448 = r4050444 / r4050442;
double r4050449 = r4050448 * r4050448;
double r4050450 = r4050447 * r4050449;
double r4050451 = r4050446 - r4050450;
double r4050452 = r4050441 / r4050451;
double r4050453 = r4050445 + r4050450;
double r4050454 = r4050443 - r4050453;
double r4050455 = r4050441 / r4050454;
double r4050456 = r4050452 / r4050455;
return r4050456;
}




Bits error versus x
Results
| 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 clear-num0.4
rmApplied div-inv0.6
Applied associate-/r*0.4
Final simplification0.4
herbie shell --seed 2019171
(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))))