# 1 3 Computing System Fundamentals 3.5 Data Representation.

## Presentation on theme: "1 3 Computing System Fundamentals 3.5 Data Representation."— Presentation transcript:

1 3 Computing System Fundamentals 3.5 Data Representation

3.5.2 Number Systems

3 Commonly used systems Decimal: base 10 Binary: base 2 Hexadecimal: base 16 Octal: base 8

4 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)...

5 Hexadecimal So 19 16 = 25 10 (1 sixteen and 9 ones), 1A 16 = 26 10, 1B 16 = 27 10, etc. As with all other systems, the LSD changes fastest. 1F 16 = 31 10, 20 16 = 32 10 The maximum 2 digit hex number is FF 16 = 255 10.

6 Hexadecimal Beyond FF 16 (255 10 ), we need a 256s column (256 10 = 16 2 ) So, FF 16 = 255 10, 100 16 = 256 10, 101 16 = 257 10...

7 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...

8 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).

9 You already know hex Hex colour codes in HTML e.g. #FF0088 is full red (255 10 ), no green and half blue (136 10 ) IP addresses e.g. 255.255.255.0 is FF.FF.FF.00 in hex WiFi security keys e.g. 33E5A10DB96EF130.