Presentation is loading. Please wait.

Presentation is loading. Please wait.

CHAPTER 3: Number Systems The Architecture of Computer Hardware and Systems Software & Networking: An Information Technology Approach 4th Edition, Irv.

Similar presentations


Presentation on theme: "CHAPTER 3: Number Systems The Architecture of Computer Hardware and Systems Software & Networking: An Information Technology Approach 4th Edition, Irv."— Presentation transcript:

1 CHAPTER 3: Number Systems The Architecture of Computer Hardware and Systems Software & Networking: An Information Technology Approach 4th Edition, Irv Englander John Wiley and Sons  2010 PowerPoint slides authored by Wilson Wong, Bentley University PowerPoint slides for the 3 rd edition were co-authored with Lynne Senne, Bentley University

2 Why Binary?  Early computer design was decimal  Mark I and ENIAC  John von Neumann proposed binary data processing (1945)  Simplified computer design  Used for both instructions and data  Natural relationship between on/off switches and calculation using Boolean logic OnOff TrueFalse YesNo 10 3-2 Copyright 2010 John Wiley & Sons, Inc.

3 Counting and Arithmetic  Decimal or base 10 number system  Origin: counting on the fingers  “Digit” from the Latin word digitus meaning “finger”  Base: the number of different digits including zero in the number system  Example: Base 10 has 10 digits, 0 through 9  Binary or base 2  Bit (binary digit): 2 digits, 0 and 1  Octal or base 8: 8 digits, 0 through 7  Hexadecimal or base 16: 16 digits, 0 through F  Examples: 10 10 = A 16 ; 11 10 = B 16 3-3 Copyright 2010 John Wiley & Sons, Inc.

4 Keeping Track of the Bits  Bits commonly stored and manipulated in groups  8 bits = 1 byte  4 bytes = 1 word (in many systems)  Number of bits used in calculations  Affects accuracy of results  Limits size of numbers manipulated by the computer 3-4 Copyright 2010 John Wiley & Sons, Inc.

5 Numbers: Physical Representation  Different numerals, same number of oranges  Cave dweller: IIIII  Roman: V  Arabic: 5  Different bases, same number of oranges  5 10  101 2  12 3 3-5 Copyright 2010 John Wiley & Sons, Inc.

6 Number System  Roman: position independent  Modern: based on positional notation (place value)  Decimal system: system of positional notation based on powers of 10.  Binary system: system of positional notation based powers of 2  Octal system: system of positional notation based on powers of 8  Hexadecimal system: system of positional notation based powers of 16 3-6 Copyright 2010 John Wiley & Sons, Inc.

7 Positional Notation: Base 10 Place10 2 10 1 10 0 Value100101 Evaluate5 x 1002 x 107 x1 Sum500207 1’s place 10’s place 527 = 5 x 10 2 + 2 x 10 1 + 7 x 10 0 100’s place 3-7 Copyright 2010 John Wiley & Sons, Inc.

8 Positional Notation: Octal 624 8 = 404 10 Place8282 8181 8080 Value6481 Evaluate6 x 642 x 84 x 1 Sum for Base 10 384164 64’s place8’s place1’s place 3-8 Copyright 2010 John Wiley & Sons, Inc.

9 Positional Notation: Hexadecimal 6,704 16 = 26,372 10 Place16 3 16 2 16 1 16 0 Value4,096256161 Evaluate 6 x 4,096 7 x 2560 x 164 x 1 Sum for Base 10 24,5761,79204 4,096’s place256’s place1’s place16’s place 3-9 Copyright 2010 John Wiley & Sons, Inc.

10 Positional Notation: Binary Place2727 2626 2525 2424 23232 2121 2020 Value1286432168421 Evaluate1 x 1281 x 640 x 321 x160 x 81 x 41 x 20 x 1 Sum for Base 10 128640160420 1101 0110 2 = 214 10 3-10 Copyright 2010 John Wiley & Sons, Inc.

11 Range of Possible Numbers  R = B K where  R = range  B = base  K = number of digits  Example #1: Base 10, 2 digits  R = 10 2 = 100 different numbers (0…99)  Example #2: Base 2, 16 digits  R = 2 16 = 65,536 or 64K  16-bit PC can store 65,536 different number values 3-11 Copyright 2010 John Wiley & Sons, Inc.

12 Decimal Range for Bit Widths BitsDigitsRange 10+2 (0 and 1) 41+16 (0 to 15) 82+256 1031,024 (1K) 164+65,536 (64K) 2061,048,576 (1M) 329+4,294,967,296 (4G) 6419+Approx. 1.6 x 10 19 12838+Approx. 2.6 x 10 38 3-12 Copyright 2010 John Wiley & Sons, Inc.

13 Base or Radix  Base:  The number of different symbols required to represent any given number  The larger the base, the more numerals are required  Base 10 : 0,1, 2,3,4,5,6,7,8,9  Base 2 : 0,1  Base 8 : 0,1,2, 3,4,5,6,7  Base 16 : 0,1,2,3,4,5,6,7,8,9,A,B,C,D,E,F 3-13 Copyright 2010 John Wiley & Sons, Inc.

14 Number of Symbols vs. Number of Digits  For a given number, the larger the base  the more symbols required  but the fewer digits needed  Example #1:  65 16 101 10 145 8 110 0101 2  Example #2:  11C 16 284 10 434 8 1 0001 1100 2 3-14 Copyright 2010 John Wiley & Sons, Inc.

15 Counting in Base 2 Binary Number Equivalent Decimal Number 8’s (2 3 )4’s (2 2 )2’s (2 1 )1’s (2 0 ) 00 x 2 0 0 11 x 2 0 1 101 x 2 1 0 x 2 0 2 111 x 2 1 1 x 2 0 3 1001 x 2 2 4 1011 x 2 2 1 x 2 0 5 1101 x 2 2 1 x 2 1 6 1111 x 2 2 1 x 2 1 1 x 2 0 7 10001 x 2 3 8 10011 x 2 3 1 x 2 0 9 10101 x 2 3 1 x 2 1 10 3-15 Copyright 2010 John Wiley & Sons, Inc.

16 Base 10 Addition Table +0123456789 00123456789 112345678910 223456789 11 33456789101112 445678 etc 910111213 3 10 + 6 10 = 9 10 3-16 Copyright 2010 John Wiley & Sons, Inc.

17 Base 8 Addition Table +01234567 001234567 1123456710 2234567 11 334567101112 4456710111213 55671011121314 667101112131415 7710111213141516 3 8 + 6 8 = 11 8 (no 8 or 9, of course) 3-17 Copyright 2010 John Wiley & Sons, Inc.

18 Base 10 Multiplication Table x0123456789 00 1123456789 224681012141618 3369121518212427 404812162024283236 551015202530354045 661218243036424854 771421283542495663 etc. 3 10 x 6 10 = 18 10 3-18 Copyright 2010 John Wiley & Sons, Inc.

19 Base 8 Multiplication Table x01234567 00 11234567 224610121416 30361114172225 44101420243034 55121724313643 66142230364452 77162534435261 3 8 x 6 8 = 22 8 3-19 Copyright 2010 John Wiley & Sons, Inc.

20 Addition BaseProblemLargest Single Digit Decimal 6 +3 9 Octal 6 +1 7 Hexadecimal 6 +9 F Binary 1 +0 1 3-20 Copyright 2010 John Wiley & Sons, Inc.

21 Addition BaseProblemCarryAnswer Decimal 6 +4 Carry the 1010 Octal 6 +2 Carry the 810 Hexadecimal 6 +A Carry the 1610 Binary 1 +1 Carry the 210 3-21 Copyright 2010 John Wiley & Sons, Inc.

22 Binary Arithmetic 11111 1101101 +10110 10000011 3-22 Copyright 2010 John Wiley & Sons, Inc.

23 Binary Arithmetic  Addition  Boolean using XOR and AND  Multiplication  AND  Shift  Division + 01 001 1110 x 01 000 101 3-23 Copyright 2010 John Wiley & Sons, Inc.

24 Binary Arithmetic: Boolean Logic  Boolean logic without performing arithmetic  EXCLUSIVE-OR  Output is “1” only if either input, but not both inputs, is a “1”  AND (carry bit)  Output is “1” if and only both inputs are a “1” 11111 1101101 +10110 10000011 3-24 Copyright 2010 John Wiley & Sons, Inc.

25 Binary Multiplication  Boolean logic without performing arithmetic  AND (carry bit)  Output is “1” if and only both inputs are a “1”  Shift  Shifting a number in any base left one digit multiplies its value by the base  Shifting a number in any base right one digit divides its value by the base  Examples:  10 10 shift left = 100 10  10 10 shift right = 1 10  10 2 shift left = 100 2  10 2 shift right = 1 2 3-25 Copyright 2010 John Wiley & Sons, Inc.

26 Binary Multiplication 1101 101 1101 1’s place 0 2’s place 1101 4’s place (bits shifted to line up with 4’s place of multiplier) 1000001 Result (AND) 3-26 Copyright 2010 John Wiley & Sons, Inc.

27 Converting from Base 10 Power Base 876543210 2 2561286432168421 8 32,7684,0965126481 16 65,5364,096256161  Powers Table 3-27 Copyright 2010 John Wiley & Sons, Inc.

28 From Base 10 to Base 2 42 10 = 101010 2 Power Base 6543210 26432168421 101010 Integer42/32 = 1 Remainder 10/16 = 0 10 10/8 = 1 2 2/4 = 0 2 2/2 = 1 0 0/1 = 0 0 10 3-28 Copyright 2010 John Wiley & Sons, Inc.

29 From Base 10 to Base 2 Base 1042 2 )42( 0 Least significant bit 2 ) 21( 1 2 )10( 0 2 )5( 1 2 )2( 0 2 )1 Most significant bit Base 2101010 Remainder Quotient 3-29 Copyright 2010 John Wiley & Sons, Inc.

30 From Base 10 to Base 16 5,735 10 = 1667 16 Power Base 43210 1665,5364,096256161 1667 Integer 5,735 /4,096 = 1 1,639 / 256 = 6 103 /16 = 6 7 Remainder 5,735 - 4,096 = 1,639 1,639 –1,536 = 103 103 – 96 = 7 3-30 Copyright 2010 John Wiley & Sons, Inc.

31 From Base 10 to Base 16 Base 108,039 16 )8,039( 7 Least significant bit 16 )502( 6 16 )31( 15 16 )1( 1 Most significant bit 16 )0 Base 161F67 Quotient Remainder 3-31 Copyright 2010 John Wiley & Sons, Inc.

32 From Base 8 to Base 10 7263 8 = 3,763 10 Power8383 8282 8181 8080 5126481 x 7 x 2x 6x 3 Sum for Base 10 3,584128483 3-32 Copyright 2010 John Wiley & Sons, Inc.

33 From Base 8 to Base 10 7263 8 = 3,763 10 7 x 8 56+ 2 =58 x 8 464+ 6 =470 x 8 3760+ 3 =3,763 3-33 Copyright 2010 John Wiley & Sons, Inc.

34 From Base 16 to Base 2  The nibble approach  Hex easier to read and write than binary  Why hexadecimal?  Modern computer operating systems and networks present variety of troubleshooting data in hex format Base 161F67 Base 20001111101100111 3-34 Copyright 2010 John Wiley & Sons, Inc.

35 Fractions  Number point or radix point  Decimal point in base 10  Binary point in base 2  No exact relationship between fractional numbers in different number bases  Exact conversion may be impossible 3-35 Copyright 2010 John Wiley & Sons, Inc.

36 Decimal Fractions  Move the number point one place to the right  Effect: multiplies the number by the base number  Example: 139.0 10 1390 10  Move the number point one place to the left  Effect: divides the number by the base number  Example: 139.0 10 13.9 10 3-36 Copyright 2010 John Wiley & Sons, Inc.

37 Fractions: Base 10 and Base 2 Place10 -1 10 -2 10 -3 10 -4 Value1/101/1001/10001/10000 Evaluate2 x 1/105 x 1/1008 x 1/10009 x1/1000 Sum.2.05.008.0009.101011 2 = 0.671875 10 Place2 -1 2 -2 2 -3 2 -4 2 -5 2 -6 Value1/21/41/81/161/321/64 Evaluate1 x 1/20 x 1/41x 1/80 x 1/161 x 1/321 x 1/64 Sum.50.1250.031250.015625.2589 10 3-37 Copyright 2010 John Wiley & Sons, Inc.

38 Fractions: Base 10 and Base 2  No general relationship between fractions of types 1/10 k and 1/2 k  Therefore a number representable in base 10 may not be representable in base 2  But: the converse is true: all fractions of the form 1/2 k can be represented in base 10  Fractional conversions from one base to another are stopped  If there is a rational solution or  When the desired accuracy is attained 3-38 Copyright 2010 John Wiley & Sons, Inc.

39 Mixed Number Conversion  Integer and fraction parts must be converted separately  Radix point: fixed reference for the conversion  Digit to the left is a unit digit in every base  B 0 is always 1 regardless of the base 3-39 Copyright 2010 John Wiley & Sons, Inc.

40 Copyright 2010 John Wiley & Sons All rights reserved. Reproduction or translation of this work beyond that permitted in section 117 of the 1976 United States Copyright Act without express permission of the copyright owner is unlawful. Request for further information should be addressed to the Permissions Department, John Wiley & Sons, Inc. The purchaser may make back-up copies for his/her own use only and not for distribution or resale. The Publisher assumes no responsibility for errors, omissions, or damages caused by the use of these programs or from the use of the information contained herein.” 3-40 Copyright 2010 John Wiley & Sons, Inc.


Download ppt "CHAPTER 3: Number Systems The Architecture of Computer Hardware and Systems Software & Networking: An Information Technology Approach 4th Edition, Irv."

Similar presentations


Ads by Google