 Home

Converting Fractional Binary Numbers

concept
Binary numbers can have decimal points in them just like regular decimal numbers. Converting fractional decimal numbers into binary has some difficulties that means you sometimes have to just get close rather than exact. In general converting numbers with decimal points isn't much more complicated than converting whole numbers but the technique has to be practiced and there are a few key points to keep in mind.
When you write decimal numbers with decimal points each digit after the decimal point has a place value just like the numbers before the decimal point. The first number after the decimal point has value $$\frac{1}{10}$$ then $$\frac{1}{100},\,\,\frac{1}{1000}$$ etc. \begin{align} 0.101_{10} & = 1\times \frac{1}{10^1} + 0\times \frac{1}{10^2} + 1\times \frac{1}{10^3}\\ \end{align} Well binary numbers work the same way but we use $$2^n$$ rather than $$10^n$$. So the first fractional digit's place value is $$\frac{1}{2} = 0.5$$ the next is $$\frac{1}{4} = 0.25$$ and so on. \begin{align} 0.101_2 & = 1\times \frac{1}{2^1} + 0\times \frac{1}{2^2} + 1\times \frac{1}{2^3}\\ & = 0.5 + 0.125\\ & = 0.625 \end{align}
fact
In a binary number the nth digit to the right of the decimal point has a place value of $$\frac{1}{2^n}$$
The first 5 place values are:
Place Fraction Value
0.1 $$\frac{1}{2}$$ 0.5
0.01 $$\frac{1}{4}$$ 0.25
0.001 $$\frac{1}{8}$$ 0.125
0.0001 $$\frac{1}{16}$$ 0.0625
0.00001 $$\frac{1}{32}$$ 0.03125
fact
To convert from fractional binary numbers to decimal just multiply each "1" by its place value and add all the results, just like with whole binary numbers.
example

Convert $$0.1101_2$$ to decimal.

There are 4 digits after the decimal point with place values: 0.5, 0.25, 0.125, 0.0625 So our conversion is: $$0.1101_2 = 1\times 0.5 + 1\times 0.25 + 1\times 0.0625$$ Or $$0.8125$$
Converting from fractional decimal to binary is a little more involved, just like with whole numbers.
fact
To convert from a fractional decimal number to binary the steps are:
1. Start your binary answer as "0."
2. Multiply the decimal number by 2, this is its new value, if it's greater than or equal to 1 write a "1" in your binary answer, otherwise write a "0"
3. The decimal number becomes the fractional part of itself (1.5 becomes 0.5)
4. Repeat Step 2 until the fractional part of the decimal number is 0
example

Convert $$0.625_{10}$$ to binary.

Our decimal number is $$D = 0.625$$ and our binary answer starts as $$B = 0.$$ Now $$D = D\times 2 = 1.25$$ That's greater than 1 so $$B = 0.1$$ Now $$D = 0.25$$ And we repeat. $$D = D\times 2 = 0.5$$ $$D \lt 1$$ so $$B = 0.10$$ $$D = 0.5$$ $$D = D\times 2 = 1.0$$ $$D = 1$$ so $$B = 0.101$$ $$D = 0.0$$ so we're finished. $$0.625_{10} = 0.101_2$$
It's possible that very simple fractional decimal numbers can become incredibly long (or infinitely long) binary numbers. For instance the decimal number 0.1 takes an infinite number of binary digits to represent. Often when you have to convert a binary decimal to a binary number you'll have to stop after some number of digits (maybe you only care up to 5 digits, maybe you just stop when you're within 1%, it depends). For this reason fractional numbers have a few problems in computer systems. Often a decimal number like 0.3 is stored as an approximation (maybe 0.30000012, I'm making these numbers up), if you use these numbers in complex mathematical expressions your answer might not be what you expect. In many applications this isn't much of a problem since the error is very small. But some applications (like banking or some types of simulations) need to be careful when handling fractional numbers to avoid these kinds of errors.
practice problems