1) convert decimal to other hexadecimal notation: Use the inverted remainder notation
Example 1: convert a decimal number 89 to a hexadecimal number
89/5 = 17 + 4, and the remainder is 4
17/5 = 3 + 2, and the remainder is 2
3/5 = 0 + 3, and the remainder is 3
Then, if the number of the five-digit system is 324, the remainder should be written in reverse order.
In turn, the calculation is:
4*5 ^ 0 + 2*5 ^ 1 + 3*5 ^ 2 = 89
Example 2: Convert decimal 957 to hexadecimal number
957/16 = 59 + 13, the remainder is 13, that is, d
59/16 = 3 + 11, the remainder is 11, that is, B
3/11 = 0 + 3, and the remainder is 3
Therefore, the hexadecimal number is 3bd.
In turn, the calculation is:
D * 16 ^ 0 + B * 16 ^ 1 + 3*16 ^ 2 = 13*16 ^ 0 + 11*16 ^ 1 + 3*16 ^ 2 = 957
(2) The conversion between the other two hexadecimal systems requires the use of decimal
For example, convert the octal number 23760 to the hexadecimal number.
First, convert the octal number to the decimal number:
23760 = 2*8 ^ 4 + 3*8 ^ 3 + 7*8 ^ 2 + 6*8 ^ 1 + 0*8 ^ 0 = 10224
Then convert the decimal number to the 7th number using the inverted remainder decimal number to 41544.
Conversion between hexadecimal