Hexadecimal

From Drunkapedia
Revision as of 14:51, 5 August 2008 by imported>Tlosk
Jump to: navigation, search

We commonly use a decimal or base 10 number system. We have 10 numbers (0 to 9), once you count past 9 you start over (the next number, 10 is composed of a 1 to indicate we've rolled over once, and 0 to start using the numbers again).


Hexadecimal is exactly the same, with one difference, instead of using 10 numbers, it uses 16 numbers. While you could make up some new figures to represent the numbers past 9 it's a lot more convenient to just use regular letters to represent those numbers. So for the missing six numbers we can use the letters A to F.

Decimal 0 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15
Hexadecimal 0 1 2 3 4 5 6 7 8 9 A B C D E F


So if instead of being a decimal based society, we were based on the hexadecimal system, a package of a dozen donuts would have the quantity listed as C donuts, instead of 12 donuts.

With more numbers available per digit, it means that instead of having 100 possibilities with 2 digits (0 to 99) you have 256 (0 to 255) or 00 to FF. A four digit hex has 65536 possibilities (0 to 65535) or 0000 to FFFF.

The windows calculator provides ready means to convert a decimal number to a hex number and a hex number to a decimal number. Under the View menu make sure Scientific is checked, then select Hex or Dec for the type of the original number. Enter the number, then click the Hex or Dec for the new number type. For example, select Dec, enter 255, click Hex, and the result will be FF.