Monday, October 4, 2010

wondering how decimal number is converted into binary number?

Binary number

Procedure to converting a Decimal Number to a Binary Number

  • 1. Firstly, draw a table to illustrate how decimal number is converted to a binary number.

Base exponent

27

26

25

24

23

22

21

20

Place value

128

64

32

16

8

4

2

1

Convert decimal to binary

  • 2. Then, determine the greatest power of 2 that is less or equal to the number in decimal that is to be converted to binary number. (X 10 ≤ 2n).
  • 3. With the highest power of2, 2n, compare it with the decimal number. If the place value of 2n is smaller than the decimal number, place ‘1’ in that column.
  • 4. Then, subtract the value of 2n from the decimal number.
  • 5. The left value is used and the same procedure followed but this time the left over value is compared with the value of 2n-1.
  • 6. ‘1’ is place in the column if the left value is greater than the value 2n-1. If it is not, place ‘0’.
  • 7. The same procedure repeated until the left over value is 0.
  • 8. Now, decimal number is converted to binary number.

Example

Convert (55)10 to binary number.

  • 1. Firstly draw the table.

Base exponent

25

24

23

22

21

20

Place value

32

16

8

4

2

1

Convert decimal to binary

  • 2. The greatest power of 2 that is less than (55)10 is 25=32.
  • 3. Since 32 is less than 55, so ‘1’ is place in the column.
  • 4. 32 is subtracted from 55 will be 23. The left over value is 23.
  • 5. 23 is compared with 24=16. 16 is less than 23, so ‘1’ is place in the column. 16 is subtracted from 23 will get 7. The left over value is 7.
  • 6. 7 is compared with 23=8. 8 is bigger than 7 so ‘0’ is place in the column. The left value is still 7 since it cannot be subtracted with 8.
  • 7. 7 is compared with 22=4. 4 is smaller than 7, so ‘1’ is place in the column and 4 is subtracted from 7. The left value will be 3.
  • 8. 3 is compared with 21=2. 2 is smaller than 3 and ‘1’ is place in the column. The left over will be 1 and compared with 20=1. 1 is subtracted from 1. Finally the left over value is 0 and the procedure is done.
  • 9. The table shall be like this.

Base exponent

25

24

23

22

21

20

Place value

32

16

8

4

2

1

Convert decimal to binary

1

1

0

1

1

1

  • 10. The conversion will be (110111)2.

No comments:

Post a Comment