\log \left(1 + x\right)
\begin{array}{l}
\mathbf{if}\;x + 1 \le 1.000001508099978009269648282497655600309:\\
\;\;\;\;\left(1 \cdot x + \log 1\right) - \frac{\left(\log \left(\sqrt[3]{\sqrt{e^{\frac{\frac{1}{2}}{\frac{1}{x}}}}}\right) + \log \left(\sqrt[3]{\sqrt{e^{\frac{\frac{1}{2}}{\frac{1}{x}}}}}\right)\right) + \log \left(\sqrt[3]{e^{\frac{\frac{1}{2}}{\frac{1}{x}}}} \cdot \sqrt[3]{e^{\frac{\frac{1}{2}}{\frac{1}{x}}}}\right)}{\frac{1}{x}}\\
\mathbf{else}:\\
\;\;\;\;\log \left(\sqrt{x + 1}\right) + \log \left(\sqrt{x + 1}\right)\\
\end{array}double f(double x) {
double r4928512 = 1.0;
double r4928513 = x;
double r4928514 = r4928512 + r4928513;
double r4928515 = log(r4928514);
return r4928515;
}
double f(double x) {
double r4928516 = x;
double r4928517 = 1.0;
double r4928518 = r4928516 + r4928517;
double r4928519 = 1.000001508099978;
bool r4928520 = r4928518 <= r4928519;
double r4928521 = r4928517 * r4928516;
double r4928522 = log(r4928517);
double r4928523 = r4928521 + r4928522;
double r4928524 = 0.5;
double r4928525 = r4928517 / r4928516;
double r4928526 = r4928524 / r4928525;
double r4928527 = exp(r4928526);
double r4928528 = sqrt(r4928527);
double r4928529 = cbrt(r4928528);
double r4928530 = log(r4928529);
double r4928531 = r4928530 + r4928530;
double r4928532 = cbrt(r4928527);
double r4928533 = r4928532 * r4928532;
double r4928534 = log(r4928533);
double r4928535 = r4928531 + r4928534;
double r4928536 = r4928535 / r4928525;
double r4928537 = r4928523 - r4928536;
double r4928538 = sqrt(r4928518);
double r4928539 = log(r4928538);
double r4928540 = r4928539 + r4928539;
double r4928541 = r4928520 ? r4928537 : r4928540;
return r4928541;
}




Bits error versus x
Results
| Original | 38.8 |
|---|---|
| Target | 0.2 |
| Herbie | 0.3 |
if (+ 1.0 x) < 1.000001508099978Initial program 59.1
Taylor expanded around 0 0.4
Simplified0.4
rmApplied add-log-exp0.4
rmApplied add-cube-cbrt0.4
Applied log-prod0.4
rmApplied add-sqr-sqrt0.4
Applied cbrt-prod0.4
Applied log-prod0.4
if 1.000001508099978 < (+ 1.0 x) Initial program 0.1
rmApplied add-sqr-sqrt0.1
Applied log-prod0.1
Final simplification0.3
herbie shell --seed 2019168
(FPCore (x)
:name "ln(1 + x)"
:herbie-target
(if (== (+ 1.0 x) 1.0) x (/ (* x (log (+ 1.0 x))) (- (+ 1.0 x) 1.0)))
(log (+ 1.0 x)))