NUMBER SYSTEMS
DEC BIN OCT HEX DEC BIN OCT HEX 0000 0001 0010 0011 0100 0101 0110 0111 1000 1001 1010 1011 1100 1101 1110 1111 10000 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 1 2 3 4 5 6 7 10 11 12 13 14 15 16 17 20 1 2 3 4 5 6 7 8 9 A B C D E F 10 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 10001 10010 10011 10100 10101 10110 10111 11000 11001 11010 11011 11100 11101 11110 11111 100000 21 22 23 24 25 26 27 30 31 32 33 34 35 36 37 40 11 12 13 14 15 16 17 18 19 1A 1B 1C 1D 1E 1F 20
CONVERSIONS FROM ONE BASE TO ANOTHER BASE
Decimal to Binary 9410 | 64 | 32 | 16 | 8 | 4 | 2 | 1 | 94/64 = 1R30 1 BASE TWO PLACE VALUE CHART | 64 | 32 | 16 | 8 | 4 | 2 | 1 | 9410 94/64 = 1R30 1 30/32 = 0R30 0 30/16 = 1R14 1 14/8 = 1R6 1 6/4 = 1R2 1 2/2 = 1R0 1 0/1 = 0R0 0 9410 = 10111102
Decimal to Binary 7210 | 64 | 32 | 16 | 8 | 4 | 2 | 1 | 72/64 = 1R8 1 BASE TWO PLACE VALUE CHART | 64 | 32 | 16 | 8 | 4 | 2 | 1 | 7210 72/64 = 1R8 1 8/32 = 0R8 0 8/16 = 0R8 0 8/8 = 1R0 1 0/4 = 0R0 0 0/2 = 0R0 0 0/1 = 0R0 0 7210 = 10010002
Decimal to Binary 5110 | 64 | 32 | 16 | 8 | 4 | 2 | 1 | 51/32 = 1R19 1 BASE TWO PLACE VALUE CHART | 64 | 32 | 16 | 8 | 4 | 2 | 1 | 5110 51/32 = 1R19 1 19/16 = 1R3 1 3/8 = 0R3 0 3/4 = 0R3 0 3/2 = 1R1 1 1/1 = 1R0 1 5110 = 1100112
BINARY TO DECIMAL Simply add up the binary place values where there is a one. Try it out on the last three slides and see how it works. Try converting the following 11101002 1010112 110100102 100111102 Base two place value chart | 256 | 128 | 64 | 32 | 16 | 8 | 4 | 2 | 1 | 11610 4310 21010 15810 Good Job
EASIEST CONVERSIONS Binary to Octal and Octal to Binary Each Base 8 digit has no more than 3 bits in the binary version. Binary to Octal Starting from the right, take groups of three bits, convert to base 8. 11010000101111002 001 101 000 010 111 100 1 5 0 2 7 4 = 1502748 Octal to Binary Write three bits for each Base 8 digit 173608 1 7 3 6 0 001 111 011 110 000 = 11110111100002
EASIEST CONVERSIONS 11010000101111002 1101 0000 1011 1100 D 0 B C Binary to Hexadecimal and to Hexadecimal to Binary Each Base 16 digit has no more than 4 bits in the binary version. Binary to to Hexadecimal Starting from the right, take groups of four bits, convert to base 16. 11010000101111002 1101 0000 1011 1100 D 0 B C = D0BC16 Hexadecimal to Binary Write three bits for each Base 16 digit 3A4F16 3 A 4 F 0011 1010 0100 1111 = 111010010011112
ONCE BASE 2 CAN BE REACHED FROM THE OTHER BASES IT IS EASY TO GET FROM ANY BASE TO ANY OTHER BASE. 9810 = 11000102 = 001 100 010 = 0110 0010 = 1 4 2 = 6 2 = 1428 = 6216 You try these. DEC BIN OCT HEX 236 _________ _____ _____ 11101100 354 EC ____ __________ 251 _____ 169 10101001 A9 111 1101111 157 ____ __________ _____ 6F
ADDING AND SUBTRACTING IN OTHER BASES ADD SUBTRACT BASE 16 2A4 D96 +97F -9AE 93E 93E +6DA -6DA REMEMBER TO THINK AND SPEAK WITH BASE 10 NUMBERS (WE HAVE THE IDEA 10 ) BUT SEE AND WRITE BASE 16 NUMERALS (WE SEE AND WRITE A ) C23 3E8 1018 264
ADDING AND SUBTRACTING IN OTHER BASES ADD SUBTRACT BASE 8 137 516 +461 -437 505 500 +245 -245 REMEMBER TO THINK AND SPEAK WITH BASE 10 NUMBERS (WE HAVE THE IDEA 8 ) BUT SEE AND WRITE BASE 8 NUMERALS (WE SEE AND WRITE 10 ) 620 57 752 233
ADDING AND SUBTRACTING IN OTHER BASES ADD SUBTRACT BASE 2 REMEMBER TO THINK AND SPEAK WITH BASE 10 NUMBERS (WE HAVE THE IDEA 8 ) BUT SEE AND WRITE BASE 2 NUMERALS (WE SEE AND WRITE 1000 ) 1010 11010 +1110 -1101 11000 1101 To simplify the ALU (arithmetic logic unit) in the CPU, the only operation the computer performs is addition. How? By using one’s and two’s complement.---
ONE'S COMPLIMENT AND TWO'S COMPLEMENT First, let’s look at base 10 ten’s and nine’s complement Instead use the ten’s compliment which is the next higher power of 10. 1000 -283 Ten’s complement - > 717 Add the 10’s compliment to the top number and throw away the 562 carry. +717 1279 Subtract: 562 -283 279 Easier way: Add 9’s complement + 1 999 So 562 This can be -283 +717 done easily Nine’s complement-> 716 1279 in your head. . +1 Same as above 717
Now for the one’s and two’s complement Subtract: 1001 - 101 100 Instead use the two’s compliment which is the next higher power of 2. 10000 -101 Two’s complement - > 1011 Add the 2’s compliment to the top number and throw away the 1001 carry. +1011 10100 Easier way: Add 1’s complement + 1 1111 So 1001 This can be -0101 +1011 done easily One’s complement-> 1010 10100 in your head. +1 Same as above 1011 In the CPU the inverter or NOT Circuit performs the 1’s complement. Easiest method of all coming up next.------------------------------->
EASIEST WAY TO GET THE TWO'S COMPLEMENT Subtract the long way. 10010111 -01101010 Rules for the easiest method 1. Copy the subtrahend exactly as it until and including the first one (1) 00101101 10 The easy method 10010111 + 2. After the first one, invert (or NOT) all bits to the one’s complement. 10010110 100101101 1 1 1 10 3. Now we have the ten’s complement. Add this to the top number. 4. Discard the carry.
Note: Negative numbers in the computer are stored in For Practice Write the two’s complement of these numbers. 1. 100011000 011101000 Good Job! 11000100 2. 00111100 010101011 3. 101010101 Note: Negative numbers in the computer are stored in two’s complement form. Also: In positive binary numbers the last bit to the left is 0. In negative binary numbers the last bit to the left is 1.
THE END