I am attempting to solve the following two questions. The first question I believe I have done the whole number calculation correctly but I am confused how to do the decimal portion. The second question I am not sure about.
$1)$ Convert $711.7$ in base $10$ to base $2$
My solution.
Looking at the whole number to the left of the decimal $711$
$$(711)_{10} = 2^9 + 2^7 + 2^6 +2^2 + 2^0 \\ =1\cdot2^9 + 0\cdot 2^8 + 1\cdot 2^7 + 1 \cdot2^6 + 0\cdot 2^5 + 0\cdot 2^4 + 0\cdot 2^3 + 1 \cdot 2^2 + 0\cdot 2^2 + 1\cdot 2^0 \\= (1011000101)_2$$
Looking at the decimal part:
$$(0.7)_{10} = 2^{-1} + 2^{-2} + 2^{-4} + 2^{-7}+...$$
This is getting closer to $0.7$ but it doesn't seem to ever actually equal it. So I how do I determine this? How do I show that it is repeating ?
My other question is can this answered be stored exactly on a computer?
Although a duplicate, i try to give the insight. It will not be short, but this is my everyday problem.
As a parallel, let us consider in base ten a periodic fraction. I will take $8/13$ which has the periodic decimal representation $0.\ 615384\ 615384\ 615384\ \dots=0.(615384)$ as i learned it in school. Now the reason for this is the fact that the first power of ten which is $1$ modulo $13$ is $10^6$, i.e. $999999/13=76923$ is the first $99\dots 9$ number divisible by $13$, the period comes from $999999/13\cdot 8 = 615384$ and the representation is shown by the long line $$ \begin{aligned} \frac 8{13} &= \frac{615384}{999999} \\ &=615384\cdot\frac 1{10^6}\cdot\frac 1{1-\frac 1{10^6}} =615384\cdot\frac 1{10^6}\cdot\left(1+\frac 1{10^6}+\frac 1{10^{12}}+\dots\right) \\ &=615384\cdot 0.\ 000001\ 000001\ 000001\ \dots \\ &=0.\ 615384\ 615384\ 615384\ \dots\ . \end{aligned} $$ (There is a little more dancing around when the denominator is not relatively prime to the basis ten.) Sorry for this, but in our case we have a similar computation.
Same computational idea, an other basis.
$$ \begin{aligned} 0.7 &=\frac 7{10}=\frac 12\cdot \frac 75 =\frac 12\cdot\left(1+ \frac 25\right) \\ &\text{ and the first $2$-power which is $1$ modulo $5$ is $16=2^4$, so...} \\ &=\frac 12\cdot\left(1+ \frac 6{16-1}\right) \\ &=\frac 12\cdot\left(1+ 6\cdot\frac 1{2^4}{1-\frac 1{2^4}}\right) \\ &=\frac 12\cdot\left(1+ 6\cdot\left( \frac 1{2^4} + \frac 1{2^8} + \frac 1{2^{12}} + \dots \right)\right) \\ &=\frac 12\cdot\left(1+ \color{blue}{110}_{\color{red}{2}}\times 0.\ 0001\ 0001\ 0001\ \dots_{\color{red}{2}} \right) \\ &=\frac 12\cdot\left(1+ 0.\ 0\color{blue}{110}\ 0\color{blue}{110}\ 0\color{blue}{110}\ \dots_{\color{red}{2}} \right) \\ &=\frac 12\cdot1.\ 0\color{blue}{110}\ 0\color{blue}{110}\ 0\color{blue}{110}\ \dots_{\color{red}{2}} \\ &=0.1\ 0\color{blue}{110}\ 0\color{blue}{110}\ 0\color{blue}{110}\ \dots_{\color{red}{2}}\ . \end{aligned} $$ Computer check:
Note: The number can be stored exactly as a fraction, but not in binary representation.
Note: Add $711$ in binary for the final answer.