|
|
bin hex dec 0000 = 0 = 0 0001 = 1 = 1 0010 = 2 = 2 0011 = 3 = 3 0100 = 4 = 4 ... 1001 = 9 = 9 1010 = A = 10 1011 = B = 11 ... 1111 = F = 15So the decimal numeral 79 whose binary representation is 0100 1111 can be written as 4F in hexadecimal.
There are many ways to denote hexadecimal numerals, used in different programming languages:
The word "hexadecimal" is strange in that hexa is derived from the Greek έξι (exi) for "six" and decimal is derived from the Latin for "ten". An older term was the pure Latin "sexidecimal", but that was changed because some people thought it too racy, and it also had an alternative meaning of "base 60".
Because the base is a square, hexadecimal fractions have an odd period much more often than decimal ones. Repeating decimals occur when the denominator has a prime factor not found in the base. In the case of hexadecimal numbers, this applies if and only if the denominator is not a power of two.
See numeral system for a list of other base systems.
Fractions
The hexadecimal system is quite good for forming fractions:
{| cellspacing=0
| 1/2 || = || 0.8
|-
| 1/3 || = || 0.5555 recurring
|-
| 1/4 || = || 0.4
|-
| 1/5 || = || 0.3333 recurring
|-
| 1/6 || = || 0.2AAAA recurring
|-
| 1/8 || = || 0.2
|-
| 1/A || = || 0.19999 recurring
|-
| 1/C || = || 0.15555 recurring
|-
| 1/F || = || 0.1111 recurring
|}