Home »
Digital Electronics
Conversion of Decimal Number System into Binary Number System
Here, we are going to learn how to convert Decimal Number System into Binary Number System?
Submitted by Saurabh Gupta, on October 12, 2019
Double Dabble Method
In this method, the decimal integer number is converted to a binary integer by successive division by 2, and the decimal fraction is converted to a binary fraction by successive multiplication by 2.
The decimal integer number is successively divided by 2 until the quotient is 0. The last remainder is the MSB. The remainders read starting from the bottom to the top give the equivalent binary integer number.
The decimal fractional number is successively multiplied by 2, till the fractional part of the product is 0. The first integer obtained is the MSB, thus the integers read from top to bottom gives the equivalent binary fraction.
To convert a mixed number to binary, we have to convert the integer and fractional part to binary separately and then combine them.
Example 1:
Convert (13.25)10 to ( ? )2
Solution:
In 13.25, we have 13 as the integral part and 0.25 as the fractional part. To get an equivalent binary number, we have to convert both to binary separately and then combine them.
Integral Part
Divisor |
Quotient |
Remainder |
2 | 13 | |
2 | 6 | 1 LSB |
2 | 3 | 0 |
2 | 1 | 1 |
2 | 0 | 1 MSB |
All the remainders read from top to bottom, where topmost is the LSB and bottom one is the MSB.
Therefore, (13)10 = (1101)2
Fractional Part
0.25 * 2 = 0.50 MSB
0.50 * 2 = 1.00 LSB
Integer part of the product term read from top to bottom.
Therefore, (0.25)10 = (0.01)2
Now, we can combine both the integral part and the fractional part to get the required binary equivalent i.e., (13.25)10 = (1101.01)2
Example 2:
Convert (15.6)10 to ( ? )2
Solution:
Converting Integral and Fractional part separately.
Integral Part
Divisor |
Quotient |
Remainder |
2 | 15 | |
2 | 7 | 1 LSB |
2 | 3 | 1 |
2 | 1 | 1 |
2 | 0 | 1 MSB |
All the remainders read from top to bottom, where topmost is the LSB and bottom one is the MSB.
Therefore, (15)10 = (1111)2
Fractional Part
0.6 * 2 = 1.2 MSB
0.2 * 2 = 0.4
0.4 * 2 = 0.8
0.8 * 2 = 1.6
0.6 * 2 = 1.2
0.2 * 2 = 0.4
0.4 * 2 = 0.8
0.8 * 2 = 1.6 LSB
Integer part of all the product terms read from top to bottom.
Therefore, (0.6)10 = (0.1001)2
Now, we can combine both the integral part and the fractional part to get the required binary equivalent i.e., (15.6)10 = (1111.1001)2
Note: If the numbers are non-terminating and non-repeating then, in that case, the process of multiplication is to be stopped after 4 or 5 decimal places.
Example 3:
Convert (18.75)10 to ( ? )2
Solution:
In 18.75, 18 is the integral part and 0.75 is the decimal part. To convert 18.75 into binary we first have to convert integral and fractional part individually and then combine them together.
Integral Part
Divisor |
Quotient |
Remainder |
2 | 18 | |
2 | 9 | 0 LSB |
2 | 4 | 1 |
2 | 2 | 0 |
2 | 1 | 0 |
2 | 0 | 1 MSB |
All the remainders read from top to bottom, where topmost is the LSB and bottom one is the MSB.
Therefore, (18)10 = (10010)2
Fractional Part
0.75 * 2 = 1.50 MSB
0.50 * 2 = 1.00 LSB
Integer part of all the product terms read from top to bottom.
Therefore, (0.75)10 = (0.11)2
Now, we can combine both the integral part and the fractional part to get the required binary equivalent i.e., (18.75)10 = (10010.11)2
TOP Interview Coding Problems/Challenges