Download presentation
Presentation is loading. Please wait.
Published byMarcia Cox Modified over 9 years ago
1
Numbering Systems Decimal (Denary) base 10. Clumsy when dealing with computers. Other systems –Binary –Octal –Hexadecimal Convenient when dealing with computers
2
Decimal Familiar system. Can use are fingers to help. Count 0 – 9 in any column, gives 10 separate values. When a count exceeds 9 we start a new column. Example: – 9 + 1 = 10 – 99 + 1 =100 Mathematically each column represents a power of ten (Base 10).
3
Decimal 456 10 = 4 x10 2 + 5 x10 1 + 6 x 10 0 We call: – 10 0 Units – 10 1 Tens – 10 2 Hundreds (x 10) – ………. And so on.
4
Binary Computers don’t have ten fingers. They work in bits A bit can only have 2 values 0 and 1 So when we exceed 1 we must start a new column as we did in decimal.
5
Binary Examples : – 1 2 + 1 2 = 10 2 – 0 2 + 1 2 = 1 2 – 10111 2 + 11 2 = 11010 2 Binary works in powers of 2. (x 2) –Columns are 128 64 32 16 8 4 2 1 – 101 2 = 1 x 2 2 + 0 x 2 1 + 1 x 2 0 2 2 = 4 10 2 1 = 2 10 2 0 = 1 10 Binary number 101 2 is therefore 5 10 in decimal.
6
Octal For large numbers Binary is cumbersome to humans. Is there a compromise? It groups 3 binary columns together. One is octal. Octal has 8 values 0 – 7.
7
Octal When we reach 7 we start a new column. Examples : – 17 8 + 1 8 = 20 8 – 777 8 + 1 8 = 1000 8 Octal works in powers of 8. (x 8) –Columns are … 512 64 8 1 –111 8 = 1 x 8 2 + 1 x 8 1 + 1 x 8 0 8 2 = 64 8 1 = 8 8 0 = 1 Octal number 111 8 is therefore 73 10 in decimal.
8
Hexadecimal For large numbers Binary is cumbersome to humans. Is there a better compromise? It groups 4 binary columns together. Hexadecimal has 16 values 0 – F. (0 –15 in decimal) We need to add 6 more symbols to represent the 2 column numbers 10 –15. We use A – F.
9
Hexadecimal When we reach F we start a new column. Examples : – 1F 16 + 1 16 = 20 16 – FFF 16 + 1 16 = 1000 16 Hexadecimal works in powers of 16. (x 16) –Columns are … 4096 256 16 1 –111 = 1 x 16 2 + 1 x 16 1 + 1 x 16 0 16 2 = 256 16 1 = 16 16 0 = 1 Hexadecimal number 111 16 is therefore 273 10 in decimal.
10
How does Hexadecimal help? Consider the 4 bit (column) binary number –1111 2 = 15 10 = F 16 That is, the largest number that can be represented by 4 bits in binary can be represented by a single value F 16. All the values in between are then 0 – F. Octal does the same for 3 bit binary.
11
How does Hexadecimal help? We can divide long binary numbers into groups of 4 and convert them directly in binary. Example the 16 bit number: –0010 1111 0001 0100 2 is 2F14 16. Computers deal in multiples of 8 (and hence 4 bits).
12
Convertions Binary, octal, Hex(adecimal) to decimal: –Add up powers as we did earlier. Examples 111 8 = 1 x 8 2 + 1 x 8 1 + 1 x 8 0 = 64 10 + 8 10 + 1 10 = 73. 111 16 = 1 x 16 2 + 1 x 16 1 + 1 x 16 0 = 256 10 + 16 10 + 1 10
13
Convertions Decimal to binary. –Find the largest power of 2 (column in binary number) that is less than or equal to the number we want to convert. –Mark a one in that column. –Subtract the power of 2 from the number we want to convert. –Repeat the above on the remainder. –Repeat until there is no remainder. –Fill missing columns with zeros.
14
Convertions Decimal to binary. –Example Convert 67 to binary: 128 64 32 16 8 4 2 1 1 64 is largest column less than or equal to 67 leaving remainder 67 – 64 = 3 128 64 32 16 8 4 2 1 1 1 2 is largest column less than or equal to the remainder 3. Leaving 1. 1 is largest column less than or equal to remainder 1. Leaving no remainder. 128 64 32 16 8 4 2 1 1 1 1 Fill with zeros. So 67 10 is 0100 0011 2
15
Convertions Decimal to hexadecimal. –Find the binary number and separate into groups of four. Express each group of 4 in hexadecimal. Example 67 10 is 0100 0011 2 is 43 16. –Find the largest multiple of each power of 16, less than or equal than your number. –Mark the multiple in that column –Repeat for the remainders as before..
16
Convertions Decimal to Hexadecimal. –Example Convert 67 to hexadecimal: 4096 256 16 1 4 4 x 16 = 64 is largest multiple less or equal to 67. Remainder 67 – 64 = 3 4096 256 16 1 4 3 3 x 1 is largest multiple less than or equal to the remainder 3. Leaving no remainder. Fill with zeros. (not necessary here) So 67 10 is 43 16
17
Convertions Hexadecimal to binary. –Take each hex symbol in turn. –Convert (or look up) to decimal. –Convert decimal number to binary. –Replace hex symbol with 4 bit binary number. –Sounds tedious, but only 6 different from decimal so becomes easy.
18
Convertions Hexadecimal to binary. –Example: –Convert 2F to binary. Take the 2. 2 is 2 in decimal. Convert to binary or look up Gives 0010 Take the F F is 15 in decimal Convert to binary or look up Gives 1111 –So 2F in binary is 0010 1111
19
Convertion Table Hexadecimal Decimal Binary. 000000 110001 220010 330011 440100 550101 66 0110 770111
20
Convertion Table Hexadecimal Decimal Binary. 881000 991001 A101010 B111011 C121100 D131101 E141110 F151111
Similar presentations
© 2024 SlidePlayer.com. Inc.
All rights reserved.