Thursday, August 29, 2019

Hexadecimal

Hexadecimal is counting in Base 16. Hexadecimal is just like decimal except that you have sixteen fingers for counting! In Base 16, you can count all the way up to 15 using only one digit. Since we have only zero (0) through nine (9) as digits, we add more. We could have chose $, #, % and so on, but to make it easier, we just chose the first six letters of the alphabet, A, B, C, D, E, F. The digits from 0 to 9 have their usual meaning, and the letters have the values 10 through 15.


SymbolValueProportion
F15
E14
D13
C123/4
B11
A10
99
881/2
77
66
55
441/4
33
22
11
00Off

When we have a number with two digits, it represents a value higher than 15 and less than 256. The first digit is the number of 16s in the value, or the 16s place. (Just as with regular decimal number, the first digits is the number of 10s or the 10s place.)

If we have a number like 0x80 (which means hexadecimal 80 to distinguish it from decimal 80), it means 8 x 16 + 0 = 128. All hex numbers can be calculated this way, but normally we don't need to. Just as we don't say 74 is 7 x 10 + 4, we would not necessarily say that 0x74 is 7 x 16 + 4 = 116. We would just that that 0x74 is a little less than 0x80, or a little less than 128. For colors, we would just think that 0x74 or #74 means the light is turned on almost halfway.

As with decimal numbers, if a number has more than one digit, we attach more importance to the first digit because it carries bigger weight. 84 is bigger than 56 because 8 is bigger than 5. We don't even think about the 4 and the 6 because they are less significant digits.


No comments:

Post a Comment

Note: Only a member of this blog may post a comment.