The Numeric Systems:
Conversion from Binary to Decimal

 

Converting a Byte From Binary To Decimal

Since the bits are numbered from right to left , you can calculate the decimal value of a byte using the base 2. Consider a binary number intensely mixed with 0s and 1s such as 11010111 (I chose this number at random). The 11010111 can be calculated as:

1 1 0 1 0 1 1 1
= 1*27 + 1*26 + 0*25 + 1*24 + 0*23 + 1*22 + 1*21 + 1*20
= 1*128 + 1*64 + 0*32 + 1*16 + 0*8 + 1*4 + 1*2 + 1*1
= 215
 

An alternative to calculating such a number is by using the following table:

128 64 32 16 8 4 2 1
               

Decimal to Binary Conversion Table

When you are presented with a binary number, you can just write the corresponding bit value under the ranking decimal number. Consider that you want to calculate the decimal equivalent of the 01110110 binary number. Using the last table, you can perform the operation like this:

128 64 32 16 8 4 2 1
0 1 1 1 0 1 1 0

This produces:

0 64 32 16 0 4 2 0
 
= 64 + 32 + 16 + 4 + 2
= 118

Using any of these techniques, you can find out the value of a combination of any 8 consecutive bits.

When all bits are 0, the byte also has a value of 0. When combining and mixing 0 and 1 bits, you can get binary values as varied as possible: 0101 0010 or 1101 1110 or 0111 1100. We only need to know what each combination would represent. Considerer another binary number such as 11001000. To convert it to the decimal system, we use the decimal to binary table conversion to get:

128 64 32 16 8 4 2 1
1 1 0 0 1 0 0 0
 
= 128 + 64 + 0 + 0 + 8 + 0 + 0 + 0
= 128 + 64 + 8 = 200
 

Practical Learning Practical Learning: Converting a Byte From Binary To Decimal

  1. On the Calculator, click the Bin radio button
  2. Using the 1 and 0 keys on the keyboard, enter 11010111
     
    Converting a Byte From Binary To Decimal
  3. Click the Dec radio button to see the result
     
    Converting a Byte From Binary To Decimal
  4. Click the buttons to display 200
  5. Click the Bin radio button to see the result
 

Converting any Number From Binary To Decimal

Once you are presented with a binary number, you can produce or use a table inspired from the binary to decimal conversion table:
Etc 214 213 212 211 210 29 28 27 26 25 24 23 22 21 20
Etc 16384 8192 4096 2048 1024 512 256 128 64 32 16 8 4 2 1

Imagine you would like to convert the 10011110011101101 binary number to a decimal value.

1 0 0 1 1 1 1 0 0 1 1 1 0 1 1 0 1
65536 32768 16384 8192 4096 2048 1024 512 256 128 64 32 16 8 4 2 1

= 65536 + 0  +   0  +8192+4096+2048+1024+  0 +   0 + 128+ 64 +32  + 0   +  8  +  4  +  0  + 1

= 65536 +               8192+4096+2048+1024      +         128+ 64 +32     +      8   + 4      +     1

= 81133

 

Practical Learning Practical Learning: Converting any Number From Binary To Decimal

  1. On the Calculator, click the Bin radio button
  2. Click the 1 and 0 buttons to display 10011110011101101
     
    Converting Any Number From Binary To Decimal
  3. Click the Dec radio button to see the result
     
    Converting Any Number From Binary To Decimal
  4. Notice the same result as our manual conversion
 

Previous Copyright 2003-2008 FunctionX, Inc. Next