Survey
* Your assessment is very important for improving the work of artificial intelligence, which forms the content of this project
* Your assessment is very important for improving the work of artificial intelligence, which forms the content of this project
Computer Systems Architecture Lesson 1 Number System Copyright © Genetic Computer School 2008 CSA 1- 0 Computer Systems Architecture LESSON OVERVIEW Different types of number systems Common bases Place values Conversion of bases Computer calculation Arithmetic of the computer Subtracting using twos complement Coding systems Binary coded decimal Floating-point numbers Numbers in standard form Integers and floating-point arithmetic Copyright © Genetic Computer School 2008 CSA 1- 1 Computer Systems Architecture NUMBER SYSTEMS A number system is the set of symbols used to express quantities as the basis for counting, determining order, comparing amounts, performing calculations, and representing value. It is the set of characters and mathematical rules that are used to represent a number. Copyright © Genetic Computer School 2008 CSA 1- 2 Computer Systems Architecture DIFFERENT TYPES OF NUMBER SYSTEMS Decimal Binary Octal Hexadecimal Copyright © Genetic Computer School 2008 CSA 1- 3 Computer Systems Architecture DECIMAL NUMBER SYSTEM The decimal or denary number system, base 10, has a radix of 10. Decimal uses different combinations of 10 symbols to represent any valy (i.e., 0,1,2,3,4,5,6,7,8 and 9) Copyright © Genetic Computer School 2008 CSA 1- 4 Computer Systems Architecture BINARY NUMBER SYSTEM Binary is known as machine language. Data is stored and manipulated inside the computer in binary. The binary number system is based on two digits, 0 and 1. Copyright © Genetic Computer School 2008 CSA 1- 5 Computer Systems Architecture OCTAL NUMBER SYSTEM The Octal number system has eight as its base; it uses the symbols 0, 1, 2, 3,4,5,6 and 7 only. For the values eight and above, need to use two digits. Copyright © Genetic Computer School 2008 CSA 1- 6 Computer Systems Architecture HEXADECIMAL NUMBER SYSTEM The Hexadecimal number has sixteen as its base; using 0,1, 2, 3, 4, 5, 6, 7, 8, 9, A, B, C, D, E and F. A, B, C, D, E and F stand for the “digits” ten, eleven, twelve, thirteen, fourteen and fifteen. Copyright © Genetic Computer School 2008 CSA 1- 7 Computer Systems Architecture PLACE VALUE Place value, positional value depends on the base used. Example: The third place from the right in base 10 has the place value 100 in base 2 has the place value 4 in base 8 has the place value 64 In base 16 has the place value 256 Copyright © Genetic Computer School 2008 CSA 1- 8 Computer Systems Architecture DECIMAL TO OTHER BASES Divide the base into the quotient and keep repeating the process until there is a zero quotient. Reading off the remainder in the reverse order of how you wrote them down gives the answer. Copyright © Genetic Computer School 2008 CSA 1- 9 Computer Systems Architecture EXAMPLE (1) 2 ) 13 2 ) 6 , remainder 1 2 ) 3 , remainder 0 2 ) 1 , remainder 1 0 , remainder 1 1310 = 11012 Copyright © Genetic Computer School 2008 CSA 1- 10 Computer Systems Architecture EXAMPLE (2) 8 ) 236 8 ) 29 remainder 4 8 ) 3 remainder 5 0 remainder 3 23610 = 3548 Copyright © Genetic Computer School 2008 CSA 1- 11 Computer Systems Architecture EXAMPLE (3) 16 ) 473 16 ) 29 remainder 9 16 ) 1 remainder D 0 remainder 1 47310 = 1D916 Copyright © Genetic Computer School 2008 CSA 1- 12 Computer Systems Architecture CHANGING DECIMAL FRACTION TO BINARY Some decimal fractions cannot be represented exactly as binary fractions. To reduce errors of this type, computers need to store such converted values to a large number of binary places. The process involves repeatedly multiplying by 2 that part of the decimal fraction to the right of the decimal point, and writing down the whole number part of the product at each stage ( but not involving it in subsequent multiplication ). Reading the whole number parts down from the top gives the binary fraction to as many places as is necessary. Copyright © Genetic Computer School 2008 CSA 1- 13 Computer Systems Architecture EXAMPLE (4) Copyright © Genetic Computer School 2008 CSA 1- 14 Computer Systems Architecture TO CONVERT A MIXED DECIMAL NUMBER (e.g. 13.746) Work separately on the whole and fraction parts. Then link the two answers together with a point. Copyright © Genetic Computer School 2008 CSA 1- 15 Computer Systems Architecture FROM OTHER BASES TO DECIMAL (Whole Number) Multiple each digit with its place value and then added together. Copyright © Genetic Computer School 2008 CSA 1- 16 Computer Systems Architecture EXAMPLE (5) 11012 = (1x8)+(1x4)+(0x2)+(1x1) = 1310 Copyright © Genetic Computer School 2008 CSA 1- 17 Computer Systems Architecture EXAMPLE (6) 11028 = (1x512) +(1x64) +(0x8) +(2x1) = 57810 Copyright © Genetic Computer School 2008 CSA 1- 18 Computer Systems Architecture EXAMPLE (7) 17F16 =(1x256) +(7x16) +(15x1) = 38310 Copyright © Genetic Computer School 2008 CSA 1- 19 Computer Systems Architecture 1s COMPLEMENT AND 2s COMPLEMENT 1s compliment and 2s compliment used to represent positive and negative number. Example Copyright © Genetic Computer School 2008 CSA 1- 20 Computer Systems Architecture Adding Binary Numbers Copyright © Genetic Computer School 2008 CSA 1- 21 Computer Systems Architecture Subtracting Binary Numbers Using Twos Compliment Copyright © Genetic Computer School 2008 CSA 1- 22 Computer Systems Architecture CODING SYSTEMS Three of the most popular coding systems are: ASCII (American Standard Code for Information Interchange) EBCDIC (Extended Binary Coded Decimal Interchange Code) BCD (Binary Coded Decimal) Copyright © Genetic Computer School 2008 CSA 1- 23 Computer Systems Architecture FLOATING POINT NUMBERS Floating-point numbers allow a far greater range of values - integer, fractional or mixed numbers, - in a single word. Calculations in floatingpoint arithmetic are slower than those in fixed-length working. Copyright © Genetic Computer School 2008 CSA 1- 24 Computer Systems Architecture STANDARD FORM The number 57429 in standard form is: 5.7429 X 104 where 5.7429 is the mantissa and 4 is the exponent. Copyright © Genetic Computer School 2008 CSA 1- 25 Computer Systems Architecture FLOATING POINT ADDITION (1) (0.1011 x 25) + (0.1001 x 25) = (0.1011 + 0.1001) x 25 = 1.0100 x 25 = 0.1010 x 26 Copyright © Genetic Computer School 2008 CSA 1- 26 Computer Systems Architecture FLOATING POINT ADDITION (2) (0.1001 x 23) + (0.1110 x 25) = (0.001001 x 25) + 0.1001) x 25 = 1.000001 x 25 = 0.1000 x 26 (after truncation) Copyright © Genetic Computer School 2008 CSA 1- 27 Computer Systems Architecture FLOATING POINT MULTIPLICATION (0.1101 x 26) x (0.1010 x 24) = 0.1000001 x 210 = 0.1000 x 210 Copyright © Genetic Computer School 2008 (after truncation) CSA 1- 28 Computer Systems Architecture FLOATING POINT DIVISION (0.1011 x 27) ÷ (0.1101 x 24) = 0.1101 x 23 Copyright © Genetic Computer School 2008 CSA 1- 29