English Deutsch Français Italiano Español Português 繁體中文 Bahasa Indonesia Tiếng Việt ภาษาไทย
All categories

When I convert a number from octal to hexadecimal, I always convert the octal to binary and then into hexadecimal, but is there a way of converting octal to hex without going through binary?

thanks^_^
^_^

2006-07-14 22:22:27 · 6 answers · asked by kevin! 5 in Science & Mathematics Mathematics

6 answers

If your octal number is at least 4 digits long, it would help to convert 4 digits of octal into 3 digits of hexadecimal at one time, by memory.

2006-07-14 22:27:19 · answer #1 · answered by Anonymous · 0 0

1.You can convert to Decimal first then convert that number to Hex, by dividing the exponential weights of 16 into the decimal number.(*the counting sequence from 0h-Fh should be memorized and kept in mind during the process).

2.Converting to Binary first is in my opinion the best way. No division necessary. Binary has all of the exponential progressions of Octal & Hex included. The method also allows for easymigration to Decimal.

I know that many books demonstrate the division method with open backward parentheses on either side of the number in question. This is cumbersome. Instead try this:

a) write/memorize sequence of Octal numbers 0-7 and Hex numbers 0-F.Remember that Octal numbers terminate after 7 & Hex numbers terminate after Fh, that position becomes 0.

b) for each of the Octal and Hex numbers translate into their binary equivalents. Remember that octal numbers translated into binary is the equivalent of groups of 3 weighted positions. 0 octal= 000 binary, 3 octal = 011binary. Remember that Hex numbers translated into binary is the equivalent of 4 weighted positions. 0h= 0000 binary, 3h= 0011 binary.

c)with paper in the landscape view draw a line with the eponential progression of 2. the 2^0 position will be the lowest weighted position and 2^12 can be the highest if you so choose.
*you can even do numbers to the other side of the decimal (binary/hex/octal) point if you dare!

d) Now when you get a Octal number, all you have to do is reference your handy dandy octal to binary reference. Starting from right to left place the binary equivalent in the colums under the exponential weights of 2.


If you add the exponential equivalents of the columns of where a 1 falls you will have the decimal equivalent.

Translating octal to Hex and vice versa is much easier.

Octal to Hex conversion
a) translate each position of the octal number into its Binary equivalent. Starting from right to left, Group the bits in threes.
If there 1 is the MSD and is left alone then put a zeroes to the left of it that would balance the group of threes.
Example: 137 octal = 001 011 111 binary

The Binary number can be grouped in to fours starting from right to left 001 011 111binary in octal grouping

= 0000 0101 1111 binary in Hex gouping.

The Hex equivalent of 0000 0101 1111 = 05Fh or simply 5Fh
Zeroes to theright of the MSD can be ignored

The process can be done in reverse to convert hex to octal.
let us use the same number.

5Fh = 0000 0101 1111 binary in hex grouping

this binary number into threes starting from right (LSB) to left (MSB): I will use asterisk to separate groups.

000*0 01*01 1*111 = 000 001 011 111 binary in octal grouping.

000 001 011 111 = 0137 octal

The verification is obtained by employing the chart in the beginning of this post. This method is relialble and verifiable.Most of All it is EZ. and you can do this All Night Long. ; )

** A calculator with BIN/HEX/OCT function will verify the answer.

***I found by writing the numbers in sequence counting (like the count) up to the decimal equivalent of 100 or more, gives a number sense of the count sequence in the base.

2006-07-15 07:28:48 · answer #2 · answered by LeBlanc 6 · 0 0

You can get this to work if you
1) Use the correct representation of the hexadecimal base (20 oct) and
2) Interpret remainders as single hexadecimal digits (which they must be).

173 oct / 20 oct = 7 oct remainder 13 oct (B hex)

7 oct / 20 oct = 0 oct remainder 7

Reading up (1st division remainder is less sig. digit, and last is most sig.)
answer 7B hex

2006-07-15 05:33:54 · answer #3 · answered by leathersammie 4 · 0 0

There is of course a way, but I think the binary way is the best way. You could always convert to some other intermediate base, like decimal. Or if you can really think in hex, you should be able to go straight.

e.g.

01234

4h -> 4h
+3h * 8h -> 18h
+2h * 40h -> 80h
+1h * 200h -> 200h
---------------------------------
29ch

It requires being good at hex math. Adding is easy, remembering 8^n is 1h,8h,40h,200h,1000h,8000h,etc. is not too bad, but it's a little work learning to multiply in hex. (The times table is bigger!)

2006-07-15 07:51:22 · answer #4 · answered by C. C 3 · 0 0

I'm sure there is, but it would be less efficient

kinda like doing long-division by roman numerals

2006-07-15 05:27:45 · answer #5 · answered by atheistforthebirthofjesus 6 · 0 0

fghdfgfd

2006-07-15 05:59:18 · answer #6 · answered by frnd_pandey 2 · 0 0

fedest.com, questions and answers