|
Question 985152: Hello Sir,
I want to know "Octal to Decimal conversion"- formula
&
Hexadecimal to Decimal conversion- formula.
Please help me in this.
Thanks
Answer by Edwin McCravy(20055) (Show Source):
You can put this solution on YOUR website!
I'm assuming you mean converting whole numbers, integers.
Converting fractions is different.
For octal, the algorithm is this, starting with the first digit
Multiply by 8
Add next digit
Multiply by 8
Add next digit
.....
In hex, just use 16 instead of 8, and remember that A=10, B=11, etc.
until you run out of digits.
Suppose you have the octal number
647210538
Start with first digit 6
6
6*8+4 = 52
52*8+7 = 423
423*8+2 = 3386
3386*8+1 = 27089
27089*8+0 = 216712
216712*8+5 = 1733701
1733701*8+3 = 13869611
647210538 = 1386961110
Suppose we have the hex number:
D59A52C16
You might want to write it this way first:
(13)59(10)52(12)
Start with D which is 13
13
13*16+5 = 213
213*16+9 = 3417
3417*16+10 = 54682
54682*16+5 = 874917
874917*16+2 = 13998674
13998674*16+12 = 223978796
So D59A52C16 = 22397879610
It's very easy with a TI graphing calculator, because when
you press *16+ after a calculation you don't have to reenter
the last number, it just automatically uses it as Ans and you
see Ans*16+. So it's very fast on a TI.
Edwin
|
|
|
| |