Hexadecimal Number System



When a program fails to execute correctly, it is sometimes necessary to examine the contents of certain memory locations to discover what is wrong. This can be done by obtaining a printout, or dump, of the contents of the memory locations (see Figure below).

Core Dump

 

If everything were printed in binary representation, the programmer would see page after page of l's and O's. Error detection would be difficult.
To alleviate this problem, the contents of memory locations in computers can be represented by the octal number system or the hexadecimal (base 16) number system. In the hexadecimal number system, sixteen symbols are used to represent the digits 0 through 15 (see Figure below).

Binary, Hexadecimal and Decimal Values

 

Note that the letters A through F designate the numbers 10 through 15. The fact that each position in a hexadecimal number represents a power of 16 allows for easy conversion from binary to hexadecimal since 16 is equal to 2 to the fourth power. A single hexadecimal digit can be used to represent four binary digits.

As noted above, four binary digits can be represented by one hexadecimal digit. This is done by considering the first four binary place values (from right to left) that sum to 15, the highest single digit value in the hexadecimal number system.

 

A binary value contained in a 32-bit word as a hexadecimal value could be converted as follows:

 

The hexadecimal value can be converted to its decimal equivalent. Keep in mind that each digit of the hexadecimal number represents a power of 16.

 


Last Updated Jan.8/99