4 replies
by vanderlay
I haven't done this in years but it is kinda like riding a bike.
Remember that each position from Right to Left represents a power of 16. I will represent the power below with parenthesis.
For the number you gave we have the following:
16(4) 16(3) 16(2) 16(1) 16(0)
If we calculate these out we have the following values:
65,535 4096 256 16 1
We then take the value stored in each position with the value of the power of 16 and add them all up.
(A *65,536) + (0 * 4096) + (1 * 256) + (2 * 16) + (F * 1)
Don't forget that A=10, B=11, C=12, D=13, E=14, and F=15
Multiplying out and then adding we get:
655,360 + 0 + 256 + 32 + 15 = 655,663
Which is the answer.
If you are ever on a UNIX machine you can execute the bc command to help in the conversion. After typing bc you then type :
ibase=16
obase=10
This tells the program that your input mode is base 16 and your output will be in decimal. Type any hex number and you get the decimal equivalent! And as always you enter CNTRL-D to exit the program.
Hope that helps!
V
by studmuffin
actually all you have to remember is that hexadecimal is a system that goes in multiples of 16.
Let's start with your example...A comes after 9 in the couting sytem, and is equivalent to 10. Here's a URL that might help you a bit:
http://www.jaworski.com/htmlbook/dec-hex.htm
Let's start with the right most number and work our way to the left.
F=15
2*16=32
1*16*16=256
0*16*16*16=0
10*16*16*16*16=10*65,536=655,360
So the sum should work out to 655,360+0+256+32+15=655,663 if I calculated this correctly. Remember, each place is a multiple of 16, that's why I multiplied by an additional factor of 16 for each place I got to the left of the rightmost digit. I hope this helps a bit.
by clslate
I am not very mathmatically oriented, so these examples here really helped me - thanks.
Now, if I wanted to reverse the process and convert decimal to hex how woud I do it? I've got an Excel spreadsheet that I've set up to do conversions usingthe Analysis ToolPak addin so I can use the Dec2Hex formulas, but I really would like to understand the processes at some point. Same for binary conversions
My dyslexic brain says, "Why?" and my Virgo personality says, "Because..."
This discussion is closed to new replies.
Trending IT Employment posts
Sort by Trending