In a recent article, we have seen how to convert any number system from decimal. However, there, we have only considered the whole numbers. In this article, we considered the decimal to binary conversion for the fractional number.
Technique
- Consider the decimal-to-binary conversion of the whole number part (the part before the decimal point) and the fractional part (the part before the decimal point) separately.
- Convert the whole number part to binary by repeated division by 2, and collecting the remainders (check here).
- Convert the fractional part to binary by repeated multiplication by 2, and collecting the carry (as shown below). This has to be done till the time the fractional part becomes zero.
Example
6.2510 = ?2
Here, the whole number part = 6
The fractional part = 0.25
Ans: 6.2510 = 110.012
Now, this was a pretty simple example. What to do if the fractional part will never reach to zero? The answer is explained in the following video.