D.3 Hexadecimal numerical system
Hexadecimal numerical system has number 16 for basis. Therefore, there are 16 different digits used in this system. These are “0, 1, 2, 3, 4, 5, 6, 7, 8, 9, A, B, C, D, E, F”. Letters A, B, C, D, E and F represent values 10, 11, 12, 13, 14, 15 and are used for the sake of easier notation. As with binary numerical system, we can apply the same formula here for determining the greatest decimal number that can be represented with a given number of hexadecimal digits.
Example:
162 - 1 = 256 - 1 = 255
Usually, hexadecimal numbers have prefix “$” or “0x” to emphasize the fact that hexadecimal system is used. Thus, number A37E should be represented with $A37E or 0xA37E. No calculations are needed for converting the hexadecimal number to binary system - it is simple substituting of hexadecimal digits with binary ones. Since maximum value of hexadecimal digit is 15, 4 binary digits are required per one hexadecimal.
Example:
Check, i.e. converting both numbers to decimal system, gives us value 228 which is correct.
In order to calculate decimal equivalent of hexadecimal number, each digit of number should be multiplied by 16 raised to power equal to the position in the number and then added altogether.
Addition works similar to two previous numerical systems.
Example:
It is required to add the appropriate digits of a number, and if their sum equals 16, that position takes value “0”. Values exceeding 16 should be added to the sum of digits on higher position. First number converted equals 14891, while other is 43457. Their sum is 58348, that is $E3EC converted to decimal numerical system. Subtraction works identically to previously mentioned systems.
Example:
Conversion gives us numbers 11590 and 5970, and the result of subtractions is 5620, that is $15F4 converted to decimal numerical system.
