Chapter 2: Number Systems The Decimal System The number system that we use in our life is called Decimal System because it contains 10 symbols (0,1,2,3,4,5,6,7,8,9). Any number you write is a combination of these 10 symbols. Like: 9806, 5, 101,..etc. Chapter 4 - Numbering Systems
Chapter 4 - Numbering Systems The Need for new system Computers are electronic devices. Since any electronic circuit has only two possible state “ON” and “OFF”. Then the decimal system is not suitable to represent information inside the computer because we need 10 different levels of representations since we have 10 symbols. It means, if you assign 0 ON, 1OFF, how can you represent 2,3,…9? Chapter 4 - Numbering Systems
Chapter 4 - Numbering Systems The Binary System The Binary System has only two symbols: 0 and 1 (this is why they called it binary). Any number in the binary system is a sequence of 0 and 1 like: 10111, 100001, 111111,….etc. The binary system is suitable to represent information inside the computer. Because it Chapter 4 - Numbering Systems
Chapter 4 - Numbering Systems has only two possible states: 1 ON, 0OFF. These 1s and 0s are referred to as binary digits. It is from this term we got the word BIT as an abbreviation to “Binary Digit”. BIT 1 Chapter 4 - Numbering Systems
Chapter 4 - Numbering Systems System’s Base When we use more than one number system, system’s base is needed: The following number is written in decimal: (1298)10 Base The following number is written in binary: (10111)2 Chapter 4 - Numbering Systems
Chapter 4 - Numbering Systems Writing Decimal Numbers in the Expansion Form A decimal number like (2067)10 can be rewritten as: 1- Coefficients are: 2,0,6 and 7. 2- Put the weights: (23026170)10 3- Multiply each coefficient by 10it’s weight: (23026170)10 = 2 103 + 0 102 + 6 101 + 7 100 =2000+0+60+7 (2067)10 Chapter 4 - Numbering Systems
Chapter 4 - Numbering Systems Another Example: A decimal number like (5179)10 can be rewritten as: 1- Coefficients are: 5,1,7 and 9. 2- Put the weights: (53127190) 10 3- Multiply each coefficient by 10it’s weight: (53127190) 10 = 5 103 + 1 102 +7 101 + 9 100 =5000+100+70+9 (5179)10 Chapter 4 - Numbering Systems
Chapter 4 - Numbering Systems Different Bases: The binary system has the base 2. For example: (11011)2, (100110)2 The Octal System has only eight symbols (0,1,2,3,4,5,6,7) and it has the base 8. For example: (12706)8, (777)8, (6007)8 The Hexadecimal System has sixteen symbols (0,1,2,3,4,5,6,7,8,9,A,B,C,D,E,F) where A represents 10, B represents 11…F represents 15. For example: (1FC94)16 Chapter 4 - Numbering Systems
Chapter 4 - Numbering Systems Converting Integer Binary Numbers to Their Equivalent in Decimal: Put the weights. Multiply each bit by 2it’s weight Sum the results of multiplications. Ex1: Convert (1011)2 to it’s equivalent in decimal (?)10 (13021110) = 123 + 022 + 121 + 120 = 8+0+2+1 (11)10 Chapter 4 - Numbering Systems
Chapter 4 - Numbering Systems Ex2: Convert (111101)2 to it’s equivalent in decimal (?)10 (151413120110)2 = 125 + 124 + 123 + 122+ 021+ 120 = 32+16+8+4+0+1 = (61)10 Chapter 4 - Numbering Systems
Chapter 4 - Numbering Systems Converting Fractional Binary Numbers to Their Equivalent in Decimal: Put the weights starting from the right of the point (-1, -2,….). Multiply each bit by 2it’s weight Sum the results of multiplications. Ex1: Convert (0.101)2 to it’s equivalent in decimal (?)10 (0.1-10-21-3)2 = 12-1 + 02-2 + 12-3 = 1 / 2 + 0 + 1 / 8 (0.625)10 Chapter 4 - Numbering Systems
Chapter 4 - Numbering Systems Ex2: Convert (0.0011)2 to it’s equivalent in decimal (?)10 (0.0-10-21-31-4)2 = 02-1 + 02-2 + 12-3 + 12-4 = 0 + 0 + 1 / 8 + 1 / 16 = 0.125 + 0.0625 = (0.1875)10 Chapter 4 - Numbering Systems
Chapter 4 - Numbering Systems Ex3: Convert (100011.1001)2 to it’s equivalent in decimal (?)10 Integer Part (100011)2 (150403021110)2 = 125 + 024 + 023 + 022+ 121+ 120 = 32+0+0+0+2+1 = (35)10 Chapter 4 - Numbering Systems
Chapter 4 - Numbering Systems Fraction Part (0.1001)2 (0.1-10-20-31-4)2 = 12-1 + 02-2 + 02-3 + 12-4 = 1 / 2 + 0 + 0 + 1 / 16 = 0. 5 + 0.0625 = (0.5625)10 Chapter 4 - Numbering Systems
Chapter 4 - Numbering Systems Converting Integer Decimal Numbers to Their Equivalent in Binary: Divide the decimal number by 2 (Integer Division). Put the remainder (0 or 1) to the left of the binary number. Apply the same division but on the result from the previous step. Stop division when the result = 0 Chapter 4 - Numbering Systems
Chapter 4 - Numbering Systems Ex1: Convert (11)10 to it’s equivalent in binary (?)2 11 2 = 5 Rem 1 5 2 = 2 Rem 1 2 2 = 1 Rem 0 1 2 = 0 Rem 1 (1 0 1 1)2 Chapter 4 - Numbering Systems
Chapter 4 - Numbering Systems Ex2: Convert (61)10 to it’s equivalent in binary (?)2 61 2 = 30 Rem 1 30 2 = 15 Rem 0 15 2 = 7 Rem 1 7 2 = 3 Rem 1 3 2 = 1 Rem 1 1 2 = 0 Rem 1 (1 1 1 1 0 1)2 Chapter 4 - Numbering Systems
Chapter 4 - Numbering Systems Converting Fractional Decimal Numbers to their Equivalent in Binary: Multiply the fraction with 2. The result in the integer part is either 1 or 0. Put this result to the right of the fraction point of the binary number. Repeat the multiplication on the fractional part until the fraction becomes equal to 0. Chapter 4 - Numbering Systems
Chapter 4 - Numbering Systems Ex1: Convert (0.625)10 to it’s equivalent in binary (?)2 0.625 2 = 1.25 0.25 2 = 0.5 0.5 2 = 1.0 (0. 1 0 1 )2 Chapter 4 - Numbering Systems
Chapter 4 - Numbering Systems Ex2: Convert (0.1875)10 to it’s equivalent in binary (?)2 0.1875 2 = 0.375 0.375 2 = 0.75 0.75 2 = 1.5 0.5 2 = 1.0 ( 0. 0 0 1 1) 2 Chapter 4 - Numbering Systems
Chapter 4 - Numbering Systems Ex3: Convert (35.5625)10 to it’s equivalent in binary(?)2 Integer Part (35)10 35 2 = 17 Rem 1 17 2 = 8 Rem 1 8 2 = 4 Rem 0 4 2 = 2 Rem 0 2 2 = 1 Rem 0 1 2 = 0 Rem 1 (100011)2 Chapter 4 - Numbering Systems
Chapter 4 - Numbering Systems The fraction part: 0.5625 2 = 1.125 0.125 2 = 0.25 0.25 2 = 0.5 0.5 2 = 1.0 (0.1001)2 The number is (100011.1001)2 Chapter 4 - Numbering Systems
Chapter 4 - Numbering Systems Binary Addition In decimal system, when you wan to add two numbers like: 4+5 then the result is 9. It means that we can represent the value nine with the symbol 9. But when we add two numbers like 5+8 then we can’t represent the value thirteen with one symbol so we use two symbols 13. Chapter 4 - Numbering Systems
Chapter 4 - Numbering Systems Actually 13 comes from 1*101 + 3*100 The same thing is applied in the binary system. 0 + 0 = 0 0 + 1 = 1 1 + 0 = 1 1 + 1 we don’t have a symbol that can represent the value two because in the binary system because the largest value is 1. Chapter 4 - Numbering Systems
Chapter 4 - Numbering Systems So, 1 1 + 10 1 1 1 1 1 + 1 0 1 1 0 0 1 1 0 1 1 1 0 1 1 1 0 1 + 0 1 0 1 1 1 0 0 1 1 0 1 + 1 1 1 0 Chapter 4 - Numbering Systems
Chapter 4 - Numbering Systems 1 0 1 1 1 1 1 1 0 1 1 0 1 1 1 1 1 1 1 + 0 0 1 1 1 1 1 0 0 0 1 0 1 0 1 1 0 1 0 1 1 + 1 1 1 0 1 1 1 1 1 1 1 0 0 0 1 0 1 0 1 1 1 Chapter 4 - Numbering Systems