The limit of $(1+\frac1x)^x$ as $x\to\infty$ I was experimenting with a graphing calculator to check
$$\lim_{x\to\infty} (1+\frac1x)^x=e$$
I plotted the graph of $y=(1+\frac1x)^x$, and I was surprised when I zoomed out enough.

It is oscillating until it reaches $x=9\times 10^{15}$, where $y$ becomes $1$ and stays there afterwards. How could we explain this?
 A: I think this is a floating point error, coming from the fact that inside computers, numbers are constantly being rounded to some fixed number of significant digits. Basically, once $x$ becomes large enough, $\frac1x$ becomes really small, and the program cannot tell the difference between $1 + \frac1x$ and $1+\frac1{x+d}$ for relatively small $d$. That means that for an entire interval, $1 + \frac1x$ gets rounded to some fixed $1+\frac1{x_0}$, and then exponentiated. You can note that on each of the separate continuous parts, the function looks very much like $a^x$ would for some constant $a$.
After $9\cdot 10^{15}$, the program just gives up completely, says "as far as I'm concerned, $1 + \frac1x = 1$" and your function becomes constant.
A: Very easily: your calculator is using double-precision floating-point arithmetic.
So the values of $1+\dfrac1x$ are truncated to $53$ bits and the larger $x$, the more significant bits are lost. You are actually computing $(1+\epsilon)^x$ where $\epsilon$ is a truncation of $\dfrac1x$ to a multiple of $2^{-53}$. In the intervals such that $\epsilon$ remains constant, you get an exponential curve.
When you exceed $x=2^{53}\approx9.0072\times10^{15}$, then $\epsilon=0$.

As you can verify, the previous jumps occur precisely at
$$\epsilon=3\cdot2^{-53}\to x\approx3.0024\times10^{15},$$
$$\epsilon=6\cdot2^{-53}\to x\approx1.5012\times10^{15},$$
and probably
$$\epsilon=7\cdot2^{-53}\to x\approx1.2867\times10^{15}.$$
The particular integers that appear depend on the details of the division algorithm used (with possible guard bits and rounding).

For the computation of the powers, logarithms are used, yielding the formula
$$\left(1+\frac1x\right)^x\approx e^{x\ln(1+\epsilon)}.$$
As $\ln(1+\epsilon)\approx\epsilon$ in theory, we can expect that $\ln(1+\epsilon)$ is evaluated like $\eta$, a value close to $\epsilon$, but not necessarily a simple multiple (also because of the inner details of the algorithm). At the jump points, $x=1/\epsilon$ and the function value is $e^{\eta/\epsilon}$.
This explains why the largest value is exactly $e^2=7.3890\cdots$, due to $\epsilon=2^{-53}$ and $\eta=2\cdot2^{-53}$.
The two values at $\epsilon=3\cdot2^{-53}$ must be exactly $e^{2/3}$ and $e^{4/3}$, corresponding to $\eta=2\cdot2^{-53}$ and $4\cdot2^{-53}$ respectively.
The values at $\epsilon=6\cdot2^{-53}$ can be conjectured to be $e^{19/24}$ and $2^{29/24}$ (from $\eta=4.75\cdot2^{-53}$ and $7.25\cdot2^{-53}$), but this is less sure.

Below is a qualitative simulation of this phenomenon with the formula
$$e^{\frac x{64}\left[\frac{64}x\right]}$$ where the brackets denote a rounding operation.

The "envelope" curves are the exponentials $e^{1\pm x/128}$.
