I am attempting to solve the following two questions. The first question I believe I have done correctly and I am looking to confirm this answer. The second question I am not sure about.
$1)$ Convert $5.1$ in base $10$ to base $2$
My solution.
Looking at the whole number to the left of the decimal $5$
$$(5)_{10} = 2^2+1 = 2^2 + 2^0 = 1\cdot2^2 + 0\cdot 2^1 + 1 \cdot2^0 = (101)_2$$
Looking at the decimal part:
How do I calculate this?
My other question is can this answered be stored exactly on a computer?
Note that $0.1=\frac1{10}=\frac12\times\frac15$. Now,\begin{align}\frac15&=\frac3{15}\\&=\frac3{2^4-1}\\&=\frac{3\times2^{-4}}{1-2^{-4}}\\&=3\times2^{-4}\times(1+2^{-4}+2^{-8}+2^{-12}+\cdots)\\&=3\times(2^{-4}+2^{-8}+2^{-12}+2^{-16}+\cdots). \end{align}So, since $3_{10}=11_2$, the binary representation of $\frac15$ is$$0.001100110011\ldots$$and therefore the binary representation of $\frac1{10}$ is$$0.0001100110011\ldots$$Finally, the binary representaion of $5.1$ is$$101.0001100110011\ldots$$This cannot be stored exactly in a binary computer, since it has infinitely many digits.