Can decimal be represented in binary?

1.1k Views Asked by At

There's one YouTube video (Conversion Of Fractions From Base Ten To Other Bases) and it shows how to convert a fraction (7/8) to base 2. So then he converts it to a decimal (0.875) and then to base 2 and he gets 0.111. When I try putting 0.875 on a base converter http://jalu.ch/coding/base_converter.php, I end up getting 0.111, but when I do it on another convert. On the same website, if I try 7/8, it doesn't allow it. On another website http://www.cleavebooks.co.uk/scol/calnumba.htm, if I try 7/8 or 0.875, it doesn't allow it.

There was another question https://stackoverflow.com/questions/1089018/why-cant-decimal-numbers-be-represented-exactly-in-binary about why decimals can't be represented in binary, but I still don't understand it.

So what I want to know is, can you really represent a decimal or fraction in binary? From the video, the answer is 0.111, but in the converter, it's 0.111. Why is that? It seems as though you can only represent decimals or fractions in binary by doing it manually. Can you have 0.(something)(something) in binary? I thought binary was supposed to be 1s and 0s. Why 0.111?

Edit 1: Thanks for correcting me with 7/8 = 0.111

3

There are 3 best solutions below

0
On

7/8=0.875 not 0.785. http://jalu.ch/coding/base_converter.php gets 0.875 to be 0.111

6
On

Whatever the vid says, any real number can be represented in binary. It may or may not have a "zero tail", but it is always possible. Same for any base, not just binary.

0
On

In order to get the successive digits after the radix point in any base, multiply the numerator by the base and divide by denominator, the whole-number quotient being the next digit and the remainder being the new numerator:

\begin{array}{|c|c|} \hline \text{Numerator} & \text{Denominator} & \text{Quotient = Digit} & \text{Remainder} \\ \hline 7 & 8 & \color{red}{0.} & 7 \\ 2\cdot 7 = 14 & 8 & \color{red}{1} & 6 \\ 2\cdot 6 = 12 & 8 & \color{red}{1} & 4 \\ 2\cdot 4 = 8 & 8 & \color{red}{1} & \fbox 0 \\ \hline\end{array}