0.9 in binary in decimal form My daughter is studying computing at university - as I'm a programmer she is coming to me for help but I'm struggling with some of the maths she is asking me.
She's asking me for help in converting 0.9 in binary to decimal form.
First I had an issue as 0.9 isn't actually representable in binary accurately - but now her tutor has advised to use 0.1110012 as an approximation. 
I can convert this in excel or in python, but to show her how to do it by hand is beyond me. Can someone help with a simple explainer to me that I can relay?
 A: You can evaluate the term like
$$
(0.d_1 d_2 d_3 \dotsb)_2
= \sum_{k=1}^{\infty} d_k 2^{–k}
= \sum_{k=1}^{\infty} \frac{d_k}{2^{k}}
$$
so
$$
(0.111001)_2 =
\frac{1}{2}+\frac{1}{4}+\frac{1}{8}+\frac{1}{64}=
\frac{32+16+8+1}{64}=
\frac{57}{64}=
0.890625
$$
The precise binary representation of $0.9$ has
infinite many digits
$$
(0.1\overline{1100})_2 =
(0.1)_2 + (0.0\overline{1100})_2 =
\frac{1}{2} + \frac{1}{2} (0.\overline{1100})_2 = \\
\frac{1}{2} + \frac{1}{2} \left( 12 \sum_{k=1}^{\infty} \frac{1}{16^k}\right) =
\frac{1}{2} + 6 \left( -1 + \frac{1}{1–\frac{1}{16}} \right) =
\frac{1}{2} +\frac{6}{15} =
\frac{9}{10} =
0.9
$$
where the bars indicate repetition and we used the formula for a geometric series
$$
\sum_{k=0}^{\infty} q^k = \frac{1}{1-q} \quad (\lvert q \rvert < 1)
$$
A: Here a kind of pseudo-code / recursion:
Let $r_0\in [0,1)$, say $r_0 = 0.9_{10}$. For $k = 1, 2, \dotsc$ let
$$ d_k = \operatorname{floor}(2 \cdot r_{k-1}) $$
and
$$ r_k = 2\cdot r_{k-1} - d_k.$$
Then,
$$ r_0 = \sum_{k=1}^\infty d_k 2^{-k} = (0.d_1d_2\dotsc)_2. $$
A: Let's try thinking in base two.  Note first that
$${1\over101}=0.001100110011\ldots$$
because $100\times0.001100110011\ldots=0.110011001100\ldots$ so that 
$$101\times0.001100110011\ldots=0.110011001100\ldots+0.001100110011\ldots=0.111111111111\ldots=1$$
(in the same way that $0.9999999999\ldots=1$ in base ten). It follows that
$${1\over1010}=0.0001100110011\ldots$$
and thus
$${1001\over1010}=1-{1\over1010}=0.1110011001100\ldots$$
A: Fractions in decimal lead to repeating decimals. We get things like $$ 10^3 \equiv -1 \pmod {37} \; , $$
 $$ 10^6 \equiv 1 \pmod {37} \; , $$
$$  \frac{1}{37} = 0.0270270270270...$$
Here, $2^4 \equiv 1 \pmod 5$ and
$$  \frac{1}{5} = \frac{\frac{3}{16}}{\frac{15}{16}} =  \frac{\frac{3}{16}}{1 -\frac{1}{16}}   $$
The point is that you know how to do this denominator as a repeating binary,
$$ \frac{1}{1 -\frac{1}{16}}  = 1 + \frac{1}{16} + \frac{1}{16^2}   + \frac{1}{16^3} ...    $$ 
or binary
$$  1.000100010001000100010001 \ldots  $$
So that is decimal $16/15.$ You also know how to write $3/16$
$$  0.0011 $$  so that $1/5$ becomes binary
$$  0.0011001100110011001100110011.. $$
and one tenth becomes binary
$$  0.00011001100110011001100110011.. $$
Next, decimal 9 is binary
$$ 1001  $$
and we need to multiply with possible carries to get decimal 9/10.
A: The solution is more compact if we first do the problem in octal, then convert the answer to binary.  So note that $0.9 = 9/10_{dec} = 11/12_{oct}$. Then apply the long division algorithm, but do all the arithmetic in octal.  This requires that you be able to multiply (by a single digit) and subtract in octal. 
$$
\require{enclose}
\begin{array}{r}
                    0.714  \\[-3pt]
12 \enclose{longdiv}{11.000} \\[-3pt]
       \underline{10.6 \phantom{0}  \phantom{0}}\\[-3pt]
                    20  \phantom{0}  \\[-3pt]
         \underline{12  \phantom{0}} \\[-3pt]
                    60   \\[-3pt] 
         \underline{50}  \\[-3pt]
10   \\[-3pt]
\end{array}
$$
So $11/12_{oct} \approx 0.714_{oct}$.
Conversion from octal to binary is easy: $0.714_{oct} = 0.111001100_{bin}$.
Alternative methods are to do everything in hexadecimal, which is yet more compact, but I find it harder to multiply and subtract in hexadecimal than in octal; or to do everything in binary, but binary requires a lot more writing, which makes for more chances to make mistakes, at least for me.
