Tim C
Tim C

Reputation: 5714

Base 8 to hexadecimal conversion

I would just like to confirm the following answer.

7037108.

8 does not form part of the number. Converting this to hexadecimal I get the answer ABCDE. Is this correct? If so what is the purpose of the subscript / base 8 which is written slightly below the number 703710.

Upvotes: 1

Views: 4628

Answers (2)

DSM
DSM

Reputation: 352979

The subscript indicates what base the number is already written in, in this case 8, so it's octal.

So 7037108 is saying that the number is 7 * 8^5 + 0 * 8^4 + 3 * 8^3 + 7 * 8^2 + 1 * 8^1 + 0 * 8^0, or 231368 in base 10.

IOW, 7037108 = 23136810 = 387C816.

ABCDE (by which you mean ABCDE16, or 0xABCDE), would be the right answer if the original number were written in base 10, because 70371010 = ABCDE16.

Upvotes: 2

Sergey Kalinichenko
Sergey Kalinichenko

Reputation: 726479

A very simple way of converting octal to hex is through binary: octal digits correspond to three binary digits, while hex digits correspond to four. Convert the number to binary, regroup by four-bit nibbles, and then convert to hex.

The number converted to binary looks like this:

111 000 011 111 001 000
7   0   3   7   1   0

Regroup by nibbles and add leading zeros for conversion to hex:

0011 1000 0111 1100 1000

Now you can easily convert the number using a lookup table.

Upvotes: 2

Related Questions