This is the way to how to convert binary string to its decimal representation after we learned how to convert binary to hexadecimal and octal. We use the same way to do this and by all these steps from the previous post and this you will be able to convert binary number or string to all the other number representations. Assume we have this binary string 110010011101, don't need to group them just add numbers as the rule of base 2 that after number 1 comes 2 and multiply by 2 to give us 4, then 4 multiply by 2 to give us 8 and so, put them on the top of binary string then add the values that have the truth value ( the truth value is 1 and false value is 0 ).

2048 1024 512 256 128 64 32 16 8 4 2 1

1 1 0 0 1 0 0 1 1 1 0 1

Compute the values with 1s only: 2048 + 1024 + 128 + 16 + 8 + 4 + 1 = 3229, hence 110010011101 = 3229 in decimal.

If we want to represent 3229 in binary we divide the number by 2 and if the remainder 1, put one, if the remainder 0, put zero until you reach to 1 then divide it by 2 to get 0.05, hence 1 because each 1 of the number 2 will take a half, as follows.

We take them from down to the top to organize them as a binary string as follows, 110010011101, this string in decimal equals 3229.

3229 / 2 = 1614 remainder = 1

1614 / 2 = 807 remainder = 0

807 / 2 = 403 remainder = 1

403 / 2 = 201 remainder = 1

201 / 2 = 100 remainder = 1

100 / 2 = 50 remainder = 0

50 / 2 = 25 remainder = 0

25 / 2 = 12 remainder = 1

12 / 2 = 6 remainder = 0

6 / 2 = 3 remainder = 0

3 / 2 = 1 remainder = 1

1 / 2 = 0.05 remainder = 1

We take them from down to the top to organize them as a binary string as follows, 110010011101, this string in decimal equals 3229.

## 0 comments:

Post a Comment