You are on page 1of 5

Convert numbers into hexadecimal form

• It is straightforward to convert hexadecimal or


binary form numbers to decimal form:
For example: AFD19F, lets add position numbers:
A(6)F(5) D(4) 1(3)9(2)F(1)=
10*16**5+15*16**4+13*16**3+1*16**2+9*16*
*1 + 15*16**0 = 11,522,463
Now the issue is how to convert this decimal
number into hexadecimal form?
1
Convert numbers into hexadecimal form

We need to find out two types of information: 1) position and


2) the related number on it, for example, the largest position 6
and the number of A on it : A(6) on the previous example.
We can use the reverse operation of power (**, or ^),
logarithm:
the exponent or power to which a base must be raised to yield
a given number. Expressed mathematically, x is the logarithm
of n to the base b if b**x = n, in which case one writes x = logb
n. For example, 2**3 = 8; therefore, 3 is the logarithm of 8 to
base 2, or 3 = log2 8.

2
Convert numbers into hexadecimal form
logarithm, can change base:
logmx=ln(x)/ln(m). ln is the natural logarithm. The
natural logarithm of a number is its logarithm to the
base of the mathematical constant e, which is an
irrational and transcendental number approximately
equal to 2.718281828459.

3
Convert numbers into hexadecimal form
Go back to our example,
Step1: find the largest position of 11522449 (dec) in the
hexadecimal form.
n-1=log16 11522449=ln(11522449)/ln(16)=5.8644
n=6.8644 = 6, means the largest position is 6.
Step 2: find the number on this position, by
11522449/16**(6-1)=10.988, just take the integer number, 10 (A)
So we get the first position and the number: A _ _ _ _ _

4
Convert numbers into hexadecimal form
Step 3: In order to find the next position and the number
related on it, we need to minus the original number by
the known A(6) number:
The A(6) relates to the number 10*16**5=10485760.
So 11522449- 10485760=1036689.

Take this number to Step 1. we can find out the largest position
and related number to it. By repeating step 1-3, we can find all the
numbers in the hexadecimal form.
Such method can apply for all bases ( 2, 4, 16,.…)

You might also like