Monday, July 12, 2010

Number Systems and Conversions

Numbers can be represented in a variety of ways. The representation depends on what is called the BASE. The following are the four most common representations.

Decimal:
We normally represent numbers in their decimal form. Numbers in decimal form are in
base 10. This means that the only digits that appear are 0-9. Here are examples of
numbers written in decimal form:
12610 (normally written as just 126)
1110 (normally written as just 11)

Binary:
Numbers in binary form are in base 2. This means that the only legal digits are 0 and 1. We need to write the subscript 2 to indicate that the number is a binary number. Hereare examples of numbers written in binary form:
11111102
10112

Decimal to Binary / Binary to Decimal:
To convert a decimal number to binary, continuously divide the number by 2 and get the remainder (which is either 0 or 1), and get that number as a digit of the binary form of the number. Get the quotient and divide that number again by 2 and repeat the whole process until the quotient reaches 0 or 1. We then get all the remainders starting from the last remainder, and the result is the binary form of the number.

NOTE: For the last digit which is already less than the divisor (which is 2) just copy the value to the remainder portion. For Example:










Binary number to Decimal:
we multiply the binary digit to "2 raised to the position of the binary number". We then add all the products to get the resulting decimal number. For Example:

No comments:

Post a Comment