A numerical coincidence with continued fractions My brother built a garage that measures 45 feet by 30 feet.  To make sure the right angles were accurate, he measured the two diagonals of the rectangle to see that they were equal.  In  inches,
\begin{align}
& \sqrt{540^2+360^2} \approx 648.999229548\text{ inches} \\[6pt]
= {} & 54\text{ feet}+1\text{ inch} - \text{less than $0.001$ inches}.
\end{align}
It's a bit odd to come within a thousandth of an inch when rounding to the nearest inch, but there's more:
$$
\sqrt{540^2+360^2} = 649 - \cfrac{1}{1298+\cfrac{1}{24073+\cdots}}.
$$
One part in twenty-four thousand??
Did I just happen to be there when someone rolled boxcars two dozen times in a row, or is there more to be said?
(Maybe I should add that $540^2+360^2 = 649^2-1$.)
PS:
$$
\sqrt{540^2+360^2} = 648 + \cfrac{1}{1+\cfrac{1}{1297+\cfrac{1}{25700+\cdots}}} \\
\text{(This part is mistaken; see below.)}
$$
Later edit: A calculator gave me the results above repeatedly; later another calculator disagreed, just as persistently, and I figured out what the truth is.
 A: Since $540^2+360^2+1^2=649^2$, we have $\sqrt{540^2+360^2} = \sqrt{649^2-1}$, and notice that since $2\cdot649=1298$, we get that
$$-649+\sqrt{649^2-1}=\frac{-1298+\sqrt{1298^2-4}}{2}\tag{1}$$
is a solution to
$$
x^2+1298x+1=0.
$$
Rearrange the quadratic equation:
$$
x = \frac{-1}{1298+x}
$$
and then substituting the expression on the right for $x$ within that very expression gives us
$$
x=\cfrac{-1}{1298-\cfrac{1}{1298-\cfrac{1}{1298-\cfrac{1}{1298-\cdots\cdots\cdots}}}}
$$
and from $(1)$ we have
$$
\sqrt{649^2-1} = 649+x.
$$
That's ONE WAY OF LOOKING AT IT, and at one level it explains it and at another it doesn't.  But it proves that this expansion is right.
A: More generally, consider $\sqrt{n^2 - 1}$. The square root of $(n^2 - 1)$ should be just slightly less than the square root of $n^2$ (which is $n$), so letting $x = n - \sqrt{n^2 - 1}$, we have $(n-x)^2 = n^2 - 1$ and therefore $2nx - x^2 = 1$, or the distance from the square root to the integer $n$ is 
$$x = \dfrac{1}{2n - x} 
= \cfrac{1}{2n - \cfrac{1}{2n - x}}
= \cfrac{1}{2n - \cfrac{1}{2n - \cfrac{1}{2n - \cfrac{1}{\dots}}}}
$$
Anyway we don't have to go that far; just the fact that $x = \frac{1}{2n + x} \le \frac{1}{2n-1}$ suffices to show that $x$ must be really small. To come within a thousandth of an inch when rounding to the nearest inch isn't surprising considering this.
Similar to continued fractions, we can also use the binomial theorem: 
$$\begin{align}
\sqrt{n^2 - 1} 
&= n\sqrt{1 - 1/n^2} = n(1 - 1/n^2)^{1/2} \\
&= n\left(1 - \frac{1}{2n^2} - \frac{1}{8n^4} - \frac{1}{16n^6} - \frac{5}{128n^8} - \dots \right)
\end{align}$$
and so
$$x = n - \sqrt{n^2 - 1} = \frac{1}{2n} + \frac{1}{8n^3} + O\left(\frac{1}{n^6}\right)$$
to see that $x$, the offset from an integer, is itself very close to $\frac{1}{2n}$, which is probably related to what the first calculator (incorrectly) gave in the first case.
