There are many instances in which numbers are best expressed in a radix other than decimal. For example, memory addresses are usually expressed in hexadecimal format, and User Identification Code (UIC) fields are expressed in octal format.
Hexadecimal format is convenient for memory contents and addresses because two hexadecimal digits can express any value contained in an 8-bit byte with no wasted space. Thus, eight hexadecimal digits can express any 32-bit (4-byte) value, the natural data size used by the VAX, and 16 hexadecimal digits can represent the 64-bit (16-byte) size used by Alpha and Itanium systems.
A hexadecimal digit is represented by the numbers 0 through 9 and the letters A through F in the following fashion:
Binary Value | Decimal | Hexadecimal |
---|---|---|
0000 | 0 | 0 |
0001 | 1 | 1 |
0010 | 2 | 2 |
0011 | 3 | 3 |
| ||
0100 | 4 | 4 |
0101 | 5 | 5 |
0110 | 6 | 6 |
0111 | 7 | 7 |
| ||
1000 | 8 | 8 |
1001 | 9 | 9 |
1010 | 10 | A |
1011 | 11 | B |
| ||
1100 | 12 | C |
1101 | 13 | D |
1110 | 14 | E |
1111 | 15 | F |
The relationship between bits and hexadecimal digits is shown in the following table:
A hexadecimal digit represents four bits, and an octal digit represents three bits. Octal digits are represented by the numbers 0 through 7, as follows: