\log \left(1 + x\right)
\begin{array}{l}
\mathbf{if}\;1 + x \le 1.00000000442313008:\\
\;\;\;\;\left(1 \cdot x + 0.33333333333333326 \cdot {x}^{3}\right) - 0.5 \cdot {x}^{2}\\
\mathbf{else}:\\
\;\;\;\;\log \left(1 + x\right)\\
\end{array}double f(double x) {
double r75580 = 1.0;
double r75581 = x;
double r75582 = r75580 + r75581;
double r75583 = log(r75582);
return r75583;
}
double f(double x) {
double r75584 = 1.0;
double r75585 = x;
double r75586 = r75584 + r75585;
double r75587 = 1.00000000442313;
bool r75588 = r75586 <= r75587;
double r75589 = r75584 * r75585;
double r75590 = 0.33333333333333326;
double r75591 = 3.0;
double r75592 = pow(r75585, r75591);
double r75593 = r75590 * r75592;
double r75594 = r75589 + r75593;
double r75595 = 0.5;
double r75596 = 2.0;
double r75597 = pow(r75585, r75596);
double r75598 = r75595 * r75597;
double r75599 = r75594 - r75598;
double r75600 = log(r75586);
double r75601 = r75588 ? r75599 : r75600;
return r75601;
}




Bits error versus x
Results
| Original | 38.9 |
|---|---|
| Target | 0.3 |
| Herbie | 0.2 |
if (+ 1.0 x) < 1.00000000442313Initial program 59.3
rmApplied flip3-+59.4
Applied log-div59.3
Taylor expanded around 0 0.2
Simplified0.2
Taylor expanded around 0 0.2
Simplified0.2
if 1.00000000442313 < (+ 1.0 x) Initial program 0.3
Final simplification0.2
herbie shell --seed 2020083
(FPCore (x)
:name "ln(1 + x)"
:precision binary64
:herbie-target
(if (== (+ 1 x) 1) x (/ (* x (log (+ 1 x))) (- (+ 1 x) 1)))
(log (+ 1 x)))