Convert octal to hex, w/out converting to Binary

In summary, to convert from octal to hex, you need to convert each digit to binary, group the binary numbers, and then convert them to hexadecimal. To convert from hex to octal, you need to convert each digit to binary, group the binary numbers, and then convert them to octal.
  • #1
NW8800
16
0
I am trying trying to convert a from octal to hex and hex to octal without using binary/dec transform using repeated divison... Logically I thought I could use the hex base in octal for repeat division which is 20 oct

Example of problem I am trying to solve,

Convert 326 octal to hex (ans 0xD6)


326 oct / 20 oct = 16 oct remainder 6 oct = 0x6

16 oct / 20 oct = 0 oct remainder 16 oct = 14 dec = 0xE!??

Reading UP^ most sig to least gives me 0xE6 not D6 i.e. I am off by 1 hex char..?

Another example 372 oct

372oct /20 oct = 18 r 12
18/20 = invalid octal number lol!

Also how would I do hex straight to octal I.e. E7C -> oct?



Please help...
 
Last edited:
Physics news on Phys.org
  • #2
To convert from octal to hex, you can use the following method:1. Convert each digit of the octal number to binary.2. Group the binary numbers into groups of four.3. Convert each group of four binary numbers to a single hexadecimal digit.For example, to convert 326 octal to hex:1. Convert each digit to binary: 3 = 0011 2 = 0010 6 = 01102. Group the binary numbers into groups of four:0011 0010 01103. Convert each group of four binary numbers to a single hexadecimal digit:0011 = 3 0010 = 2 0110 = 6Therefore, 326 octal = 0xD6 hex.To convert from hex to octal, you can use the following method:1. Convert each hexadecimal digit to four binary digits.2. Group the binary numbers into groups of three.3. Convert each group of three binary numbers to a single octal digit.For example, to convert 0xE7C hex to octal:1. Convert each hexadecimal digit to four binary digits: E = 1110 7 = 0111 C = 11002. Group the binary numbers into groups of three:111 001 110 1003. Convert each group of three binary numbers to a single octal digit:111 = 7 001 = 1 110 = 6 100 = 4Therefore, 0xE7C hex = 7614 octal.
 
  • #3



Hi there, it seems like you are trying to convert octal numbers to hex without using binary or decimal transformations. While this is possible, it can be quite tricky and requires a good understanding of the number systems involved. I will try to provide some guidance to help you with your problem.

Firstly, let's review the conversion process for octal to hex. In octal, the base is 8 and in hex, the base is 16. This means that for every 8 digits in octal, there is 1 digit in hex. So, we can divide the octal number into groups of 3 digits and then convert each group to hex separately.

Let's take your first example, 326 octal. We can divide it into 3 groups: 3, 2, and 6. Now, to convert each group to hex, we can use the following chart:

Octal | Hex
------|-----
0 | 0
1 | 1
2 | 2
3 | 3
4 | 4
5 | 5
6 | 6
7 | 7

As you can see, the values in octal and hex are the same for numbers 0-7. So, for the first group (3), we can simply write it as 3 oct = 3 hex. For the second group (2), we can write it as 2 oct = 2 hex. And for the third group (6), we can write it as 6 oct = 6 hex.

Therefore, our converted hex number is 326 oct = 326 hex. However, since we are trying to convert it without using binary or decimal, we need to represent the hex number in octal. To do this, we can again divide the hex number into groups of 3 digits and convert each group to octal.

So, 326 hex can be divided into 3, 2, and 6. Using the same chart as before, we can write 3 hex = 3 oct, 2 hex = 2 oct, and 6 hex = 6 oct. Therefore, our final converted octal number is 326 oct.

Now, let's take a look at your other example, 372 oct. When we divide it into groups of 3 digits, we get 3, 7, and 2. Using
 

Related to Convert octal to hex, w/out converting to Binary

1. How do I convert octal to hex without converting to binary?

There are a few different methods for converting octal to hex without converting to binary, but one common approach is to first convert the octal number to decimal, then convert the decimal number to hexadecimal. Another method is to use the octal and hexadecimal equivalents of each digit and convert them directly.

2. Can I use a calculator to convert octal to hex without converting to binary?

Yes, most scientific or programming calculators have functions for converting between different number systems, including octal and hexadecimal. Simply input the octal number and select the option to convert it to hexadecimal.

3. Is there a shortcut for converting octal to hex without converting to binary?

Some people find it easier to remember the decimal equivalents of each octal digit and then use those to convert to hexadecimal directly. For example, the octal number 175 would be equivalent to 125 in decimal, which converts to 7D in hexadecimal.

4. Why is it important to convert octal to hex without converting to binary?

Converting between different number systems is a fundamental skill in computer science and programming. Understanding how to convert between octal and hexadecimal without using binary can help with tasks such as debugging code or understanding memory addresses.

5. Can I convert octal to hex without converting to binary by hand?

Yes, converting octal to hex without converting to binary can be done by hand using the methods mentioned above. However, using a calculator or conversion tool can save time and reduce the risk of errors.

Similar threads

  • Engineering and Comp Sci Homework Help
Replies
3
Views
905
  • Engineering and Comp Sci Homework Help
Replies
1
Views
4K
  • Engineering and Comp Sci Homework Help
Replies
13
Views
4K
Replies
4
Views
985
  • Engineering and Comp Sci Homework Help
Replies
1
Views
10K
  • Introductory Physics Homework Help
Replies
2
Views
85K
  • Engineering and Comp Sci Homework Help
Replies
5
Views
2K
  • Introductory Physics Homework Help
Replies
2
Views
2K
  • Computing and Technology
Replies
1
Views
5K
Replies
6
Views
9K
Back
Top