90 likes | 211 Views
3 Computing System Fundamentals. 3.5 Data Representation. 3.5.2 Number Systems. Commonly used systems. Decimal: base 10 Binary: base 2 Hexadecimal : base 16 Octal: base 8. Hexadecimal. In hex , we must invent some more digits to count above ten. 0, 1, 2, 3, 4, 5, 6, 7, 8, 9, then
E N D
3 Computing System Fundamentals • 3.5 Data Representation
Commonly used systems • Decimal: base 10 • Binary: base 2 • Hexadecimal: base 16 • Octal: base 8
Hexadecimal • In hex, we must invent some more digits to count above ten. • 0, 1, 2, 3, 4, 5, 6, 7, 8, 9, then • A (ten), B (eleven), C (twelve), D (thirteen), E (fourteen), F (fifteen) • Only then do we start a new (sixteens) column: 10 (sixteen), 11 (seventeen)...
Hexadecimal • So 1916 = 2510 (1 sixteen and 9 ones), 1A16 = 2610 , 1B16 = 2710 , etc. • As with all other systems, the LSD changes fastest. • 1F16 = 3110 , 2016 = 3210 • The maximum 2 digit hex number is FF16 = 25510.
Hexadecimal • Beyond FF16 (25510), we need a 256s column (25610 = 162 ) • So, FF16 = 25510 , 10016 = 25610 , 10116 = 25710...
Why hexadecimal? • Computers cannot work in decimal. • Humans find binary hard (long to write and difficult to remember and convert). • Sixteen is two to the power of four. • So to convert binary to hex is simple...
Why hexadecimal? • Take a long binary number, e.g.100101110010110111011001 • Split it into groups of four: 1001-0111-0010-1101-1101-1001 • And convert each group to hex: 972DD9 • So one hex digit represents half a byte (hex digits often occur in pairs to represent a whole byte).
You already know hex • Hex colour codes in HTML e.g. #FF0088 is full red (25510 ), no green and half blue (13610) • IP addresses e.g. 255.255.255.0 is FF.FF.FF.00 in hex • WiFi security keys e.g. 33E5A10DB96EF130.