• ### What is your GameDev Story?

#### Archived

This topic is now archived and is closed to further replies.

# Hexadecimal! I don't get it!

This topic is 6884 days old which is more than the 365 day threshold we allow for new replies. Please post a new topic.

## Recommended Posts

I just don''t understand Hexadecimal. Could please TRY explaining it? Imagine talking to a 6 year old that has been living in a cave it''s whole life. LOL Thanks a lot! -Alex

##### Share on other sites
Well, I''ll have to try pretending you''re a 8 year old instead.

When you write a decimal number the value of the number relates to the digits and where they are. A digit just to the left of the decimal (the one''s place) is worth 1 times the digits value. A digit just to the left of the one''s place (the ten''s place) is worth 10 times the value of the digits. A digit just to the left of the ten''s place is worth 100 times the value of the digit. And so on each time multiplying by 10.

In hexadecimal. You have 16 digits instead of ten digits. And each place is worth 16 times the previous one. The digits 0,1,2,3,4,5,6,7,8,9 are all worth their normal values. A is worth 10, B is worth 11, C is worth 12, D is worth 13, E is worth 14 and F is worth 15.

The hex number A0 is the value of A (10) times 16 plus the value of 0 times 1 (160).
The hex number 1A0 is the value of 1 times 256 plus the value of A (10) times 16 plus the value 0 times 1 (416).

##### Share on other sites
Think of Decimal numbering.. you have 0..9
Now imagine that you didn''t stop at 9, instead when you got past 9 you used the first couple of letters of the alphabet.
0,1,2,3,4,5,6,7,8,9,a,b,c,d,e,f
a=10
b=11
c=12
d=13
e=14
f=15

Now the trick to reading hex is to start from the right digit.
The first digit is always easy, just convert it to decimal.

0x17f

f=15

now move over one to the left.
now since we are one row over, this row is multiplied by 16
so we look at the value, convert it to decimal then multiply by 16
7=7, but since 2nd column, = 7 * 16 = 112
everytime you move over a row you have to multiply by 16
it''s basically powers of 16.

3rd column
1=1 , but 3rd row, so multiply by 256, 1*256 = 256

now just add all computations from above
15
112
256
===
383

0x17f = 183

another way to look at it is like this
0x17f = 256*1 + 16*7 + 1*f
or
0x17f = (16^2)*1 + (16^1)*7 + (16^0)*f

Keeb

##### Share on other sites
before you try to understand Hexedecimal (base-16), first learn how our own decimal system works. lets look at the example decimal number and decipher it.
12,851
you know how the places go: ones, tens, hundreds, thousands, ten-thousands, etc., starting at ONE!! (very important). each followong place is multiplied by the base, which is 10 in the decimal system, where we get all the subsequent places. to get the number itself, we multiply the place value by the number in the corresponding place position (i.e, 1 *1, 5 * 10, 8 * 100, 2 * 1000, 1 * 10000), and then add up all the values produced. the same rules apply to base-2,base-8,base-16,base-37,whetever. the place is multiplies by the number in the places position, and result are added. in the base-2 system, the places are 1, 2, 4, 8, 16, 32, 64, 128, 256, etc. (do you see why? each subsequent place is multiplies times the base, which is two). So, the binary number 01101101 is 109. we get this by adding: 1 * 1, 0 * 2, 1 * 4, 1 * 8, 0 * 16, 1 * 32, 1 * 64.
adds up to 109, doesn''t it.

so, in conclusion, this is the architecture of all number systems.

##### Share on other sites
quote:

so, in conclusion, this is the architecture of all number systems.

Tell that to the darn Romans. Or the Mayans for that matter.

##### Share on other sites
Maybe he was talking about all the "current" number systems (hex, oct)?

/. Muzzafarath

##### Share on other sites
If those above explainations didn''t help, I''m writing a programming tutorial webpage. There is a page devoted to explaining Hex, Octal, Decimal, and Binary. It''s written for beginners, so it''s very readable. Go to:

http://bung.org/tutorial/

Good Luck!

• ### What is your GameDev Story?

In 2019 we are celebrating 20 years of GameDev.net! Share your GameDev Story with us.

• 29
• 16
• 10
• 10
• 11
• ### Forum Statistics

• Total Topics
634112
• Total Posts
3015581
×