Hexadecimal numbers are another form of computer code, but is mostly associated with
memory (as far as I know). The way our number system, the decimal system, uses the digits
0-9, and the binary system uses 0 and 1, well the hexadecimal system uses the digits 0-9
AND the letter A-F. This is so each hexadecimal can use a one-digit number to represent 16
Hexadecimal numbers go in the form of 0, 1, 2, 3, 4, 5, 6, 7, 8, 9, A, B, C, D, E, F. The first form of conversion we use is to convert decimal numbers to hexadecimal is by using a method which uses binary conversion; we convert the number to binary and then to hexadecimal.
Let's convert the number 739 to hexadecimal. First, convert it to binary.
Decimal to binary conversion
|Now we take the binary number in segments of four, starting with the least significant digit, or the right hand side. So we can take it that the first segment is 0011, the second is 1110, and the third is 10, but we add two 0's to the start to make it four digits; the third is now 0010. We look at the table below to see what the hexadecimal digits are.|
What we do is see what segment corresponds to what hexadecimal number. Starting from the
most significant side (left hand side), the hexadecimal number is 2, the next is E, and
the last is 3. Put these together and you have 2E3. Just to wrap things up, any
hexadecimal number should be denoted with a small H at the end, e.g. 2E3H
The next method is a shorter method, but may not necessarily be easier in some cases. We just take the decimal number to be converted, divide by 16 until the numerator is 0, and stop there. We will convert the number 89066, since it is a large number.
Dividing to get hexadecimal numbers
|16 |5566||R = 10|
|16 |347||R = 14|
|16 |21||R = 11|
|16 |1||R = 5|
|0||R = 1|
|Starting with the last remainder, we convert the remainders into hexadecimal numbers; 1 5 11 14 10 = 15BEAH = the hexadecimal number! That's how conversion is done, the second way. Now, to convert hexadecimal back to decimal is easy. Just set up a table as I have done below.|
Converting hexadecimal to decimal
|16~4||16~3||16~2||16~1||16~0||Power of 16|
|65536||4096||256||16||1||Power - Decimal|
|1||5||11||14||10||Hexadecimal - Decimal|
As can be observed here, the hexadecimal digits was placed under its corresponding power
of 16, and multiplied, giving the decimal number on the bottom line e.g. 16~2 x B = 2816
(256 x 11 = 2816). All these decimal numbers can be added up to give the original decimal
number : 89066!
You can also convert it back to decimal using the binary method, except backwards. Next, you can learn about other forms of number codes, e.g. BCD and Octal, including other small things.
BCD and Octal Numbers