Spring 2000

Computer Science 3410 - Tutorials

Number Representation and Conversion

  1. The Binary system is based on the number 2, the only digits used to represent the numbers in base 2 are 0 and 1. The number (10001111)2 really means 1*2^7 + 0*2^6 + 0*2^5 + 0*2^4 + 1*2^3 + 1*2^2 + 1*2^1 + 1*2^0

  2. The Octal system is based on 8. The representation consists of the digits 0,1,2,3,4,5,6 & 7. The number 375 means 3*8^2 + 7*8^1 + 5*8^0

  3. We are most familiar with the Decimal system. It is bassed on the number 10 and the only digits allowed are 0,1,2,3,4,5,6,7,8 & 9. The number 2130 really means 2*10^3 + 1*10^2 + 3*10^1 + 0*10^0

  4. What about bases greater than 10? Since we only have nine digits, when we have a base greater than base 10, we normally use letters of the alphabet. FOr example, the hexadecimal system is based on 16, the digits/letters used are 0,1,2,3,4,5,6,7,8,9,A,B,C,D,E & F. The number A27 really means A*16^2 + 2*16^1 + 7*16^0

Representation of a number in a system with base N may only consist of digits that are less than N.

Below is a handy number converter. Type in a value in any of the boxes (ie, either type a decimal number in the decimal box or a hex number in the hex box) and press the button that says "click" next to it. Upon clicking, the number will be converted to the other representatons if it is legal.

Binary:

 
Octal:  
Decimal:  
hexadecimal: