TITLE: Why does Excel fail to properly evaluate $ \lim_{x \to 0} \frac{x(e^x+1)-2(e^x-1)}{x^3} $?
QUESTION [6 upvotes]: I have this limit:
$$
\lim_{x \to 0} \frac{x(e^x+1)-2(e^x-1)}{x^3}
$$
By using L'Hospital rule and Maclaurin expansion I both found that limit equals to $1/6$.
I want to simulate this to my student by Excel but I failed.
This is my computation in Excel.

I did not know why Excel doesn't work in this situation?
Please help me. Thanks alot.

REPLY [3 votes]: In the evaluation of the numerator you can incur a floating point error of about the size $(2+|x|)e^x\mu$, $\mu=2^{-52}$ being the machine constant. For $x\approx0$ this is $2\mu\approx 4\cdot 10^{-15}$. In the quotient this makes an error of $\frac{2\mu}{x^3}$.
In the series expansion the next term after the constant one is $\frac{x}{12}$. The floating point error becomes larger than the linear term at about $\frac{x}{12}=\frac{2\mu}{x^3}$, that is, $x=\sqrt[4]{24\mu}=2.7\cdot10^{-4}$. This is the region of minimal error, and also the point where your results turn away from convergence.