How can I generate the binary representation of any real number?

Every real number $\alpha>0$ (to make things simpler) can be developed into an infinite binary expansion of the form $$110\ldots10\,.\,1011101\ldots\ ,$$ where to the left of the "decimal" point we only have finitely many digits and to the right an unending sequence of digits. Numbers of the form $n/2^N$ $\ (n, N\in{\mathbb N}_{\geq0})$ have exactly two such representations (this is the $0.999\ldots=1.000\ldots$ phenomenon in decimal), all other numbers have exactly one representation. In fact it is possible to construct the full real number system (with addition, multiplication and order) as such an "uncountable list" of binary fractions. This has been sketched by Gowers here: http://www.dpmms.cam.ac.uk/~wtg10/decimals.html

A real number $\alpha>0$ can be considered as "given" when for each $N$ it is possible to name an integer $a_N$ such that $${a_N\over 2^N}\leq \alpha<{a_N+1\over 2^N}\ .$$ Using induction one easily proves that $$2 a_N\leq a_{N+1}\leq 2a_N+1\ ,$$ and this implies that the finite binary representation of $a_{N+1}$ is obtained from the representation of $a_N$ by appending a $0$ or a $1$. Now the quotients $a_N/2^N$ approximate the given number $\alpha$. Writing $a_N$ in binary and separating the last $N$ digits by a "decimal" point we therefore get a finite binary approximation of $\alpha$, and things work out such that for $N'>N$ the first $N$ places (after the "decimal" point) of $a_N$ and $a_{N'}$ coincide. In this way we get an ever better approximation of $\alpha$ just by adding new "binary places" to the right.


When I say $\pi = 3.14\ldots$ in decimal, what does that mean? In principle, what it really means is that $\pi$ times a hundred is at least the integer three hundred and fourteen, and is less than three hundred and fifteen. And since I already know how to write the decimal representation of an integer, I can write down $314$ and then shift the point two places up to get $3.14$. So the first few digits of the decimal representation of $\pi$ are $3.14$. If I want more digits, I multiply $\pi$ by a bigger power of the base, in this case ten, and compare that result with the integers.

The binary representation is exactly the same thing, except with powers of two instead of powers of ten. For example, $\pi$ times eight is a little over twenty-five (which is $11001$ in binary), so the binary representation of $\pi$ goes $11.001\ldots$.