\log \left(1 + x\right)
\begin{array}{l}
\mathbf{if}\;x + 1 \le 1.000007462280689596312299727287609130144:\\
\;\;\;\;\left(\left(\left(1 \cdot {x}^{3} + \left(1 \cdot x + 0.5 \cdot \frac{x \cdot x}{{1}^{2}}\right)\right) + \frac{0.3333333333333333148296162562473909929395}{\frac{{1}^{3}}{{x}^{3}}}\right) - \frac{{x}^{3}}{1}\right) - \left(x \cdot x\right) \cdot 1\\
\mathbf{else}:\\
\;\;\;\;\log \left(x + 1\right)\\
\end{array}double f(double x) {
double r57746 = 1.0;
double r57747 = x;
double r57748 = r57746 + r57747;
double r57749 = log(r57748);
return r57749;
}
double f(double x) {
double r57750 = x;
double r57751 = 1.0;
double r57752 = r57750 + r57751;
double r57753 = 1.0000074622806896;
bool r57754 = r57752 <= r57753;
double r57755 = 3.0;
double r57756 = pow(r57750, r57755);
double r57757 = r57751 * r57756;
double r57758 = r57751 * r57750;
double r57759 = 0.5;
double r57760 = r57750 * r57750;
double r57761 = 2.0;
double r57762 = pow(r57751, r57761);
double r57763 = r57760 / r57762;
double r57764 = r57759 * r57763;
double r57765 = r57758 + r57764;
double r57766 = r57757 + r57765;
double r57767 = 0.3333333333333333;
double r57768 = pow(r57751, r57755);
double r57769 = r57768 / r57756;
double r57770 = r57767 / r57769;
double r57771 = r57766 + r57770;
double r57772 = r57756 / r57751;
double r57773 = r57771 - r57772;
double r57774 = r57760 * r57751;
double r57775 = r57773 - r57774;
double r57776 = log(r57752);
double r57777 = r57754 ? r57775 : r57776;
return r57777;
}




Bits error versus x
Results
| Original | 38.8 |
|---|---|
| Target | 0.1 |
| Herbie | 0.2 |
if (+ 1.0 x) < 1.0000074622806896Initial program 59.1
rmApplied flip3-+59.2
Applied log-div59.1
Simplified59.1
Taylor expanded around 0 0.3
Simplified0.3
if 1.0000074622806896 < (+ 1.0 x) Initial program 0.1
Final simplification0.2
herbie shell --seed 2019194
(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)))