wpe41.gif (23084 bytes)CIS3355: Business Data Structures
Fall, 2008
 

An Alternative Method for converting from Binary to Decimal

Return to Home Page

Some of you may have learned an alternative method for converting from binary to decimal. Whatever method works for you is fine with me.

Let's take the binary number: 101 (which we know is 5 in base 10). The way that we went over it in class was:

Exponent 2 1 0
Bit 1 0 1

 

  → 1 * 22 + 0 * 21 + 1 * 20 = 22 + 20 = 4 + 1 = 5

 

Instead of using simply the exponent value, we could have entered in the Value of our exponent (i.e., the value of 2n, where n is the exponent value):

Exponent Value 4 2 1
Bit 1 0 1


 Notice that as we go from right to left the, exponent value doubles each time.

 

Now all we have to do is add the exponent values whenever the bit is 1:  4 + 1 = 5

Let's take another example: convert 110110012 to decimal.

Method 1:

Exponent 7 6 5 4 3 2 1 0
Bit 1 1 0 1 1 0 0 1

 

 

 

= 27 + 26  + 24 + 23 + 20 = 128 + 64 + 16 + 8 + 1 = 217

Method 2:

Exponent Value 128 64 32 16 8 4 2 1
Bit 1 1 0 1 1 0 0 1

 

 

 

= 128 + 64 + 16 + 8 + 1 = 217

It's really the same, but we are (sort-of) eliminating one step.

  This page was last updated on 02/11/04