🎧 New: AI-Generated Podcasts Turn your study notes into engaging audio conversations. Learn more

CTCC0113-Course-Packet-04.pdf

Loading...
Loading...
Loading...
Loading...
Loading...
Loading...
Loading...

Transcript

CTCC0113 Introduction to Computing Learning Module 02 Principles and Concepts of Computing Systems Course Packet 04 Number Systems in Computing 26 ...

CTCC0113 Introduction to Computing Learning Module 02 Principles and Concepts of Computing Systems Course Packet 04 Number Systems in Computing 26 CTCC0113 Introduction to Computing Course Packet 04 Number Systems in Computing Introduction This course packet introduces you to the importance of number systems in computing and the representation of the different number systems supported by computer architecture. Objectives At the end of this course packet, you will be able to: Differentiate between number systems. Convert to different number bases Learning Management System The free eLMS like Moodle or the LMP will used for asynchronous learning sessions and assessments. All the activities and learning materials can be accessed through the eLMS. Class code will be given at the start of the synchronous session. Duration Topic 02: Number Systems in Computing = 5 hours (3 hours of self-directed learning with practical exercises and 2 hours of assessment) Delivery Mode This module will be delivered online (synchronous and asynchronous). Assessment with Rubrics The assessments and activities that will be used are Number System Conversions for fill the blanks and Crossbin Puzzle, Multiple Choices Single Selection, converting number systems to ASCII Code which are all objective type scoring model. 27 CTCC0113 Introduction to Computing Introduction This course packet introduces you to the different number systems supported by computer architecture and their representation. You will also learn how to convert between the number systems. Pre-Assessment Answer the Number System Conversions Worksheet What is a Number System? A number system provides a means to represent numbers, in the computer system architecture, all kinds of data are represented using a defined number system. These data include audio, graphics, video, text and numerals which are all represented in binary numbers. Efficiency of Number System Number systems provide the basis for all operations in information processing systems. In a number system the information is divided into a group of symbols A group of bits which is used to represent the discrete elements of information is a symbol. The number systems supported by computer architecture is shown in Figure 20. Binary Octal Base 2 Base 8 Digits : 0 and Digits: 0-7 1 Decimal Hexadecimal Base 10 Base 16 Digits: 0-9 Digits: 0-9 and A-F Figure 20. Number systems in computing 28 CTCC0113 Introduction to Computing The total number of digits used in a number system is called its base or radix. A value of each digit in a number can be determined using The digit The position of the digit in the number The base of the number system Decimal Number System Decimal number system is a base 10 number system having 10 digits from 0 to 9. This means that any numerical quantity can be represented using these 10 digits. Decimal number system is a positional value system. This means that the value of digits will depend on its position. Consider the examples in the table. Table 02. Decimal Digit Values Based on Position Powers of 10 104= 103=1000 102 =100 101 = 10 100 = 1 Decimal 10000 Value 18 1x101 8x100 813 8x102 1x101 3x100 7089 7x103 0x102 8x101 9x100 The decimal values represent the sum of each digit multiplied to the corresponding powers of 10. In all the examples, the value of the digit 8 varies according to its position. In 18, value of 8 is 8 units derived from 8x100, in 813, value of 8 is 8 hundreds derived from 8x102, while for 7089, 8 is 8 tens derived from 8x101. Binary Number System The binary number system is a base 2 number system having only two digits: 0 and 1. Each binary digit is also called a bit; 8 bits together make a byte. The data in computers is stored in terms of bits and bytes. Binary number system is also a positional value system, where each digit has a value expressed in powers of 2. The decimal equivalent of any binary number is the sum of product of each digit with its positional value. 29 CTCC0113 Introduction to Computing Table 03. Bit Values Based on Position Powers of 2 Binary 24= 16 23=8 22 =4 21 = 2 20 = 1 Value 110102 1x24 1x23 0x22 1x21 0x20 100012 1x24 0x23 0x22 0x21 1x20 100112 1x24 0x23 0x22 1x21 1x20 110102 = 1×24 + 1×23 + 0×22 + 1×21 + 0×20 = 16 + 8 + 0 + 2 + 0 = 2610 Following the same procedure, 100012 will be equal to 1710 and 100112 will be equal to 1910. It can be observed that only the bits set to 1 are added to get the equivalent in decimal, since the bits set to 0 will only yield a 0 value when multiplied. Octal Number System Octal number system has eight digits, ranging from 0 –7. Octal number system is also a positional value system with where each digit has its value expressed in powers of 8. Decimal equivalent of any octal number is sum of product of each digit with its positional value. Table 04. Octal Values Based on Position Powers of 8 Octal 84= 4096 83=512 82 =64 81 = 8 80 = 1 Value 268 2x81 6x80 1268 1x82 2x81 6x80 7268 7x82 2x81 6x80 7268 = 7×82 + 2×81 + 6×80 = 448 + 16 + 6 = 47010 Consequently, 268 and 1268 will be equal to 2210 and 8610 respectively. 30 CTCC0113 Introduction to Computing Hexadecimal Number System Hexadecimal number system has 16 symbols, 0 to 9 and A to F where A is equal to 10, B is equal to 11 and so on, until F equals 15. Hexadecimal number system is also a positional value system with where each digit has its value expressed in powers of 16. Decimal equivalent of any hexadecimal number is sum of product of each digit with its positional value. Table 05. Hexadecimal Values Based on Position Powers of 16 164= 163=512 162 161 = 8 160 = 1 Hexadecimal 4096 =64 Value 2616 2x161 6x160 AC16 A(10)x161 C(12)x160 1B816 1x162 B(11)x161 8x160 1B816 = 1×162 + 11×161 + 8×160 = 256 + 176 + 8 = 44010 Consequently, 2616 and AC16 will be equal to 3810 and 17210 respectively. Relationship between Number Systems From the descriptions of each number system, it can be determined that they share common digits, to which when used as a single digit will have the same value. For example, 0 and 1 across all numbers systems have the same values, 2 is the same representation in decimal, octal and hexadecimal but is represented as 10 in binary. Table 04 summarizes the equivalences of the digits across each number systems. 31 CTCC0113 Introduction to Computing Table 06. Equivalent Values of Digits across Number Systems HEXADECIMAL DECIMAL OCTAL BINARY 0 0 0 0000 1 1 1 0001 2 2 2 0010 3 3 3 0011 4 4 4 0100 5 5 5 0101 6 6 6 0110 7 7 7 0111 8 8 10 1000 9 9 11 1001 A 10 12 1010 B 11 13 1011 C 12 14 1100 D 13 15 1101 E 14 16 1110 F 15 17 1111 It is important to remember that when digits are combined in a specific number system, the values also change based from the positional value of each digit. Take into consideration 1010, 102, 108 and 1016 which represent different values. As seen on the table, 102 = 210, 108 = 810 while 1016 = 1610. 32 CTCC0113 Introduction to Computing ASCII Besides numerical data, computer must be able to handle other forms such as alphabets, punctuation marks, mathematical operators, special symbols, etc. that completes the character set of the English language. The complete set of characters or symbols are called alphanumeric codes. The typical alphanumeric code is composed of uppercase and lowercase letters, digits, punctuation marks and special characters. Since a computer understands only numeric values, all characters must have a numeric equivalent called the alphanumeric code. The most widely used alphanumeric code is the American Standard Code for Information Interchange (ASCII). Figure 21. ASCII Character to Binary There are many methods or techniques which can be used to convert numbers from one base to another. Other Base System to Decimal Decimal to Other Base System Other Base System to Non-Decimal 33 CTCC0113 Introduction to Computing Other Base System to Decimal System As seen in the previous discussion of the non-decimal base systems, converting them to decimal is based on their positional value. In summary the following steps allows conversion of any number system to decimal: Step 1 − Determine the positional value of each digit depending on the given number system. Step 2 − Multiply the value obtained in Step 1 with the digit in the corresponding position. Step 3 − Add the products computed in Step 2. The total will be the equivalent value in decimal. Examples: Step Binary Decimal Number Step 1 101012 ((1 x 24) + (0 x 23) + (1 x 22) + (0 x 21) + (1 x 20))10 Step 2 101012 (16 + 0 + 4 + 0 + 1)10 Step 3 101012 2110 Step Octal Decimal Number Step 1 1018 ((1 x 82) + (0 x 81) + (1 x 80))10 Step 2 1018 (64 + 0 + 1)10 Step 3 1018 6510 Step Hexadecimal Decimal Number Step 1 2BA16 ((2 x 162) + (11 x 161) + (10 x 160))10 Step 2 2BA16 (512 + 176 + 10)10 Step 3 2BA16 69810 34 CTCC0113 Introduction to Computing Decimal to Other Base System When converting decimal to other number systems, the division method is used with the following steps: Step 1 − Divide the decimal number to be converted by the value of the new base. Step 2 − Get the remainder from Step 1 as the rightmost digit of the new base number. Step 3 − Divide the quotient of the previous divide by the new base. Step 4 − Record the remainder from Step 3 as the next digit of the new base number. Repeat Steps 3 and 4, getting remainders from right to left, until the quotient becomes zero in Step 3. Examples: Step Operation Result Remainder Step 1 29 / 2 14 1 Step 2 14 / 2 7 0 Step 3 7/2 3 1 Step 4 3/2 1 1 Step 5 1/2 0 1 The binary equivalent of 2910 = 111012. As mentioned in Steps 2 and 4, the remainders have to be arranged in the reverse order so that the first remainder becomes the right most digit and the last remainder becomes the first digit. Step Operation Result Remainder Step 1 1028 / 8 128 4 Step 2 128 / 8 16 0 Step 3 16 / 8 2 0 Step 4 2/8 0 2 The octal equivalent of 102810 = 20048 35 CTCC0113 Introduction to Computing Step Operation Result Remainder Step 1 2021 / 16 126 5 Step 2 126 / 16 7 14 = E Step 3 7 / 16 0 7 The hexadecimal equivalent of 202110 = 7E516 Other Base System to Non-Decimal System Conversion between non-decimal number system can be accomplished in multiple ways, from the previous steps provided this can be accomplished with the following steps: Step 1 − Convert the original number to a decimal number. Step 2 − Convert the decimal number obtained to the new base number. For example, to convert 378 to binary, Step 1 - Convert to Decimal Step Octal Decimal Number Number Step 1 378 ((3 x 81) + (7 x 80))10 Step 2 378 (24 + 7)10 Step 3 378 3110 This results to 378 = 3110 Step 2 - Convert Decimal to Binary Step Operation Result Remainder Step 1 31 / 2 15 1 Step 2 15 / 2 7 1 Step 3 7/2 3 1 Step 4 3/2 1 1 Step 5 1/2 0 1 This results to 3110 = 111112 Therefore, 378 = 111112 36 CTCC0113 Introduction to Computing Shortcut Method Conversion between non-decimal number systems can also be accomplished following shortcut methods, including the following: Binary to Octal Step 1 − Group the binary digits by three (starting from the right most bit). Step 2 − Convert each group of three binary digits to one octal digit. For example, to convert the value derived in the previous example, 111112 to Octal, the steps are applied in the table: Step Binary Octal Number Number Step 1 111112 011 111 Step 2 111112 3 7 Step 3 111112 378 In step 1, the binary value is grouped by 3 bits, separating 011 and 111, note that the additional zero on the left does not affect the value of the number. Converting each 3-bit value results to 378 which verifies the values used in the example using the long method. This process can be reversed to convert from octal to binary with the following steps: Step 1 − Convert each octal digit to a 3-digit binary number. Step 2 − Combine all the resulting binary groups (of 3 digits each) into a single binary number. To convert 538 to binary Step Octal Binary Number Number Step 1 538 5 3 Step 2 538 1012 0112 Step 3 538 1010112 37 CTCC0113 Introduction to Computing In the first step, 5 is converted to 101 and 3 is converted to 011 separately. Combining the 3-bit values will result to the binary Number : 1010112 The shortcut method is possible for binary and octal since every digit in the octal number system can be represented using 3 bits, with the last digit 7 in octal, represented as 111 in binary. The same case can be applied to binary and hexadecimal but his time grouping bits by 4 since the last digit in hexadecimal, F equal to 15, can be represented by 1111 in binary. Binary to Hexadecimal Step 1 − Divide the binary digits into groups of four, starting from the right most bit. Step 2 − Convert each group of four binary digits to one hexadecimal symbol. To convert 1010112 Step Binary Number Hexadecimal Number Step 1 1010112 0010 1011 Step 2 1010112 2 B Step 3 1010112 2B16 In Step 1, the binary value is grouped by 4 bits, separating 0010 and 1011, note that the additional zeros on the left does not affect the value of the number. Converting each 4-bit value results to 2 and 11 which is represented by B. 38 CTCC0113 Introduction to Computing Hexadecimal to Binary Step 1 − Convert each hexadecimal digit to a 4-digit binary number. Step 2 − Combine all the resulting binary groups (of 4 digits each) into a single binary number. To convert 2716 to binary: Step Hexadecimal Binary Number Step 1 2716 27 Step 2 2716 00102 01112 Step 3 2716 001001112 In the first step, 2 is converted to 0010 and 7 is converted to 0111 separately. Combining the 3-bit values will result to the binary Number : 001001112 or 1001112. 39

Tags

number systems computing computer architecture education
Use Quizgecko on...
Browser
Browser