The Math Forum

Ask Dr. Math - Questions and Answers from our Archives
Associated Topics || Dr. Math Home || Search Dr. Math

Converting Numbers: Binary to Decimal

Date: 11/20/97 at 02:40:32
From: Linda Davidson
Subject: Converting numbers from binary to decimal

I am taking Computer Science 105 at a local college. I just cannot 
get how to convert from binary to decimal and back again. Is there a 
simple formula? 


Date: 11/20/97 at 08:26:14
From: Doctor Jerry
Subject: Re: Converting numbers from binary to decimal

Hi Linda,

The easiest half is to convert from binary to decimal. Just remember 
that the first place to the left of the "decimal" point is 2^0 = 1, 
the second place is 2^1, and so on; to the right of the "decimal" 
point is 2^(-1) = 1/2 in the first place, 2^(-2) = 1/4 in the second 
place, and so on.

So, 10011.01  is 1*2^4+0*2^3+0*2^2+1*2^1+1*2^0+0*2^(-1)+1*2^(-2), 
which is 8+2+1+1/4 = 11.25.

Going the other way is slightly harder. Take the base 10 number 57, 
for example.  57 = d_0*2^0+d_1*2^1+d_2*2^2+... Read d_0 as d sub 0 and 
so on.  The numbers d_0, d_1,... are the binary digits in the binary 
expansion of 57. They are 0 or 1. If we divide 57 by 2 we get 28.5.  

Looking at d_0*2^0+d_1*2^1+d_2*2^2+...divided by 2 we get
d_0/2+d_1+d_2*2^1+...  So, 2*(d_0/2) is the first digit.  In 28.5, if 
we get .5, then 1 is d_0; if we get 0, then 0 is d_0.  

Now, in your calculator containing 28.5, subtract the 0.5, leaving 28.  
Again divide by 2. You get 14.0.  So, d_1=0. Again divide by 2. You 
get 7. So, d_2 = 0. Similarly, d_3 = 1, d_4 = 1, and d_5 = 1.  

Let's check.  111001 is 1*2^5+1*2^4+1*2^3+1*2^0 = 32+16+8+1 = 57.

If you have 57.325, you can do the 57 and the 0.375 parts separately.  
Using similar ideas, just multiply 0.375 by 2 repeatedly to get the 
digits. For example, 0.375*2 = 0.75. So the first digit to the right 
is 0; 0.75*2 = 1.5 so the second digit is 1.  0.5*2 = 1 so 0.375 is 

You can also look at   

-Doctor Jerry,  The Math Forum
 Check out our web site!   
Associated Topics:
High School Number Theory

Search the Dr. Math Library:

Find items containing (put spaces between keywords):
Click only once for faster results:

[ Choose "whole words" when searching for a word like age.]

all keywords, in any order at least one, that exact phrase
parts of words whole words

Submit your own question to Dr. Math

[Privacy Policy] [Terms of Use]

Math Forum Home || Math Library || Quick Reference || Math Forum Search

Ask Dr. MathTM
© 1994- The Math Forum at NCTM. All rights reserved.