Why doesn't substituting very large $n$ into $(1+1/n)^n$ give values approaching Euler's number $e$? I would like to ask what is the Euler's number $e$? I don't understand it.
What I Know:

*

*$e$ is $\left(1+\dfrac{1}{n}\right)^n$ as $n$ reaches infinity


*$e$ is $2.718281828\ldots$
Question:

If I input $n = 1\ 000\ 000\ 000\ 000$, I get $2.718523496\ldots$, which is higher than $2.718281828\ldots$.
If I go on and input $n = 1\ 000\ 000\ 000\ 000\ 000$, I get $3.035035207\ldots$ which is way higher than $2.718281828\ldots$.

I think I missed something or I made a mistake.

Did I misunderstand the formula? Is the formula and the $2.718281828$ above only an approximation?

I would really appreciate any explanation, clarification, and corrections. :)
Thank you so much for you time!
 A: Here's an error analysis. If
$$a_n=\left(1+\frac1n\right)^n$$
then
$$\ln a_n=n\ln\left(1+\frac1n\right)=n\left(\frac1n-\frac1{2n^2}+\frac1{3n^3}-\cdots\right)=1-\frac1{2n}+\frac1{3n^2}-\cdots.$$
For large $n$, $\ln a_n$ is very close to
$$1-\frac1{2n}$$
and so $a_n$ is close to
$$e\exp(-1/(2n))=e\left(1-\frac1{2n}+\frac1{8n^2}-\cdots\right).$$
Actually the $1/(8n^2)$ term here is spurious as I neglected the $1/(3n^2)$ term
in the expansion of $\ln a_n$. But a crude estimate of $a_n$ is that
$$a_n\approx e-\frac{e}{2n}.$$
The error is slightly worse than $1/n$.
Taking $n=10^{12}$ say, you get about $11$ to $12$ correct decimal places.
The error you get with the calculator is no doubt due to its lack of
precision of its representation of floating point numbers. Probably
underflow.
A: Floating point math in a computer is not the same as real math computation.  Back when we used $32$ bit floats, which only gave $23$ bits of mantissa, about $7.2$ decimal digits, it was a problem everybody worried about and large sections of numerical analysis courses concentrated on avoiding the problems of numerical precision.  Now that floats are $64$ bits with $53$ bits of mantissa the problem has been greatly reduced, but it still can have a problem.  When you raise to a very small power you can think about $(1+\frac 1n)^n=e^{(\log(1+\frac 1n)n)}$ and expand $\log(1+\frac 1n)$ in a Taylor series.
