Converting Hexadecimals

142 Views Asked by At

I need help converting Hexadecimals.

How do I go about converting something like E0D base 16 to decimal? How about to binary?

5

There are 5 best solutions below

0
On BEST ANSWER

HEXADECIMAL TO DECIMAL

To convert hexadecimal to decimal, first we need to know how the number systems work. I decimal, each digit is 10 times as large as the previous digit. So for instance, 123, in decimal, is $(1 \times 10\times 10) + (2 \times 10) + (3 \times 1)$, or instead, $(1 \times 10^2) + (2 \times 10^1) + (3 \times 10^0)$.

123, in hexadecimal is $(1 \times 16\times 16) + (2 \times 16) + (3 \times 1)$, or instead, $(1 \times 16^2) + (2 \times 16^1) + (3 \times 16^0)$. So this is equal to $(1\times 256) + (2 \times 16) + (3 \times 1)$ which equals 291.

To use the letters that are in hex, we note that A = 10, B = 11, C = 12, D = 13, E = 14, and F = 15. So E0D in hexadecimal is $(14 \times 16^2) + (0 \times 16^1) + (13 \times 16^0)$ = 3597 in decimal.

HEXADECIMAL TO BINARY

To convert hexadecimal into binary, we can note that each hexadecimal digit is equal to precisely one 4-digit number in binary. The conversion goes:

$$\text{Hexadecimal}, \text{Binary}$$ $$0 = 0000$$ $$1 = 0001$$ $$2 = 0010$$ $$3 = 0011$$ $$4 = 0100$$ $$5 = 0101$$ $$6 = 0110$$ $$7 = 0111$$ $$8 = 1000$$ $$9 = 1001$$ $$A = 1010$$ $$B = 1011$$ $$C = 1100$$ $$D = 1101$$ $$E = 1110$$ $$F = 1111$$

So the number E0D in hexadecimal becomes (E=1110)(0=0000)(D=1101) which becomes $1110, 0000, 1101$ or $111000001101$ in binary.

0
On

$E0D$ in base $16$ means it's equal to $E*16^2 + 0*16^1 + D*16^0$, where $E$ has value $14$, and $D = 13$. That gives you a formula for converting to base $10$. To convert to binary convert each digit to binary, e.g. $D = 1101$ and concatenate the result i.e. concatenate $E_b \cdot 0_b \cdot D_b$ to get $1110 0000 1101$. Do you know why you can just convert the digits and concatenate? It has something to do with $2^4 = 16$.

0
On

Converting to binary: just take each digit and convert it to the four bit sequence for the number. $E$ => $1110$, $0$ => $0000$, $D$ => $1101$ and then concatenate them so $E0D $ becomes $111000001101$

As for converting to decimal remember that each digit represents a power of 16 similar. The letters represent numbers greater than 9 (A - 10, B - 11, C - 12, D - 13, E - 14, F - 15). So multiply and sum:

$15 * 16^2 + 0 * 16^1 + 12$

5
On

To convert to decimal, each position is a factor of $16$ larger. I will change the middle from $0$ to $A$ to get rid of multilplying by zero. So $EAD_{16}=14\cdot 16^2 + 10\cdot 16 + 13$ Because $16=2^4$, to convert from hex to binary you can just write each digit as a four bit binary number, so $EAD_{16}=1110\ 1010\ 1101_2$

0
On

Converting to binary is trivial, you write each hex digit with 4 binary digits, e.g. $0 = 0000$, $1 = 0001$, and so forth, and $E = 1110$ and $F = 1111$, and you simply replace each hex digit by its equivalent representation of 4 binary digits and concatenate the representations of binary digits. Converting to decimal is more complicated. One of the easiest ways to convert between bases with a computer is to first calculate your number in computer integer representation using the original base, e.g. representing each hex digit $a_j$ as between $0$ and $15$, and calculating $x = \sum_{j=0}^n 16^j a_j$, and then to get the decimal digits for $x$ you first compute remainder when you divide by $x$ by $10$, e.g. by integer arithmetic on computer, and this gives you your least significant digit, and then you divide $x$ by $10$ and get the integer part (e.g. using integer division) and then repeat taking the remainder when you divide by 10 to get the 2nd decimal digit, and so forth, Keep going until until you get 0 when you divide by 10 and take the integer part. This gives you all the decimal digits from least significant to most significant in order.