The decimal system
The decimal number system is the most commonly used system in everyday life. It has digits that range from 0-9 which can be used to represent an infinite range of numbers. For example, numbers like 10, 1643, -138 etc. are all decimal numbers. Every digit in the number has a unique position known as its place value. For example, consider the decimal number 1735.26, the place values of each and every digit give the number its true value. In simpler terms this means, 1735.26 = (1*103) + (7*102) + (3*101) + (5*100) + (2*10-1) + (6*10-2)
Each number represents the tenth value of its position, digits to the right of decimal point however, represent the one-tenth value of its position. Therefore, the number is read as one thousand seven hundred thirty-five point two-six.
It is possible to interconvert numbers within different number systems. For example, binary to decimal, decimal to hexadecimal and many others. In simpler terms a number can be written in any number system. The basic representation of hex numbers in terms of decimal numbers are:
The steps of converting a decimal number to a hexadecimal number are explained below:
Step 1: Divide the number by 16, and note down the remainder
Step 2: Divide the quotient obtained in the step above again by 16 and note down its remainder.
Step 3: Repeat step 2 until you get a remainder less than 16
Step 4: Numbers ranging from 0-15 can be converted to hex form as per the table given above.
Step 5: Start writing the remainders achieved in the process from the last to the first in order.
The last remainder forms the most significant digit of the hex code and the first remainder obtained acts as the least significant digit. Replace numbers from 10-15 by A-F.
These steps are explained again with an example for a better understanding.
Example 1: Convert 3479 to its hexadecimal equivalent.
The decimal number to be converted is 3479.
Step 1: Divide 3479 by 16, we get 217 as quotient and 7 as remainder.
Step 2: As 217>16, divide it by 16, we get 13 as quotient and 9 as remainder.
Step 3: Now, 13<16. Thus, stop the process and replace 13 with D.
Step 4: Note all the remainders from bottom to top. Thus,
(3479)10 = (D97)16
Example 2: Convert 65498 to its decimal equivalent
Step 1: 65498 ÷ 16
Quotient = 4093; Remainder = 10 (replaced by A)
Step 2: 4093 ÷ 16
Quotient = 255; Remainder = 13 (replaced by D)
Step 3: 255 ÷ 16
Quotient = 15; Remainder = 15 (replaced by F)
Step 4: As 15<16, we stop the process and write the remainders in reverse order.
We get (65498)10 = (FFDA)16
NOTE: A number represented in hex form uses less digits in its representation than decimal form. Example 1735 is in its decimal form and has 4 digits but, when converted to its hexadecimal form it becomes 6C7 which has only 3 symbols for its representation.