Upcoming SlideShare
×

# Number System

6,152 views

Published on

number system

Published in: Technology
1 Comment
3 Likes
Statistics
Notes
• Full Name
Comment goes here.

Are you sure you want to Yes No
• good effort, like this

Are you sure you want to  Yes  No
Views
Total views
6,152
On SlideShare
0
From Embeds
0
Number of Embeds
359
Actions
Shares
0
328
1
Likes
3
Embeds 0
No embeds

No notes for slide

### Number System

1. 1. Number Systems (Class XI)‏ Nita Arora (KHMS)‏ PGT Comp. Sc.
2. 2. Why Binary? <ul><li>Early computer design was decimal </li></ul><ul><ul><li>Mark I and ENIAC </li></ul></ul><ul><li>John von Neumann proposed binary data processing (1945)‏ </li></ul><ul><ul><li>Simplified computer design </li></ul></ul><ul><ul><li>Used for both instructions and data </li></ul></ul><ul><li>Natural relationship between on/off switches and calculation using Boolean logic </li></ul>0 1 No Yes False True Off On
3. 3. Counting and Arithmetic <ul><li>Decimal or base 10 number system </li></ul><ul><ul><li>Origin: counting on the fingers </li></ul></ul><ul><ul><li>“ Digit” from the Latin word digitus meaning “finger” </li></ul></ul><ul><li>Base : the number of different digits including zero in the number system </li></ul><ul><ul><li>Example: Base 10 has 10 digits, 0 through 9 </li></ul></ul><ul><li>Binary or base 2 </li></ul><ul><li>Bit (binary digit): 2 digits, 0 and 1 </li></ul><ul><li>Octal or base 8: 8 digits, 0 through 7 </li></ul><ul><li>Hexadecimal or base 16: 16 digits, 0 through F </li></ul><ul><ul><li>Examples: 10 1 0 = A 16 ; 11 10 = B 16 </li></ul></ul>
4. 4. Keeping Track of the Bits <ul><li>Bits commonly stored and manipulated in groups </li></ul><ul><ul><li>8 bits = 1 byte </li></ul></ul><ul><ul><li>4 bytes = 1 word (in many systems)‏ </li></ul></ul><ul><li>Number of bits used in calculations </li></ul><ul><ul><li>Affects accuracy of results </li></ul></ul><ul><ul><li>Limits size of numbers manipulated by the computer </li></ul></ul>
5. 5. Numbers: Physical Representation <ul><li>Different numerals, same number of oranges </li></ul><ul><ul><li>Cave dweller: IIIII </li></ul></ul><ul><ul><li>Roman: V </li></ul></ul><ul><ul><li>Arabic: 5 </li></ul></ul><ul><li>Different bases, same number of oranges </li></ul><ul><ul><li> 5 10 </li></ul></ul><ul><ul><li>101 2 </li></ul></ul><ul><ul><li>12 3 </li></ul></ul>
6. 6. Number System <ul><li>Roman: position independent </li></ul><ul><li>Modern: based on positional notation (place value)‏ </li></ul><ul><ul><li>Decimal system: system of positional notation based on powers of 10. </li></ul></ul><ul><ul><li>Binary system: system of positional notation based powers of 2 </li></ul></ul><ul><ul><li>Octal system: system of positional notation based on powers of 8 </li></ul></ul><ul><ul><li>Hexadecimal system: system of positional notation based powers of 16 </li></ul></ul>
7. 7. Positional Notation: Base 10 43 = 4 x 10 1 + 3 x 10 0 Sum Evaluate Value Place 3 40 3 x1 4 x 10 1 10 10 0 10 1 1’s place 10’s place
8. 8. Positional Notation: Base 10 527 = 5 x 10 2 + 2 x 10 1 + 7 x 10 0 500 5 x 100 100 10 2 Sum Evaluate Value Place 7 20 7 x1 2 x 10 1 10 10 0 10 1 1’s place 10’s place 100’s place
9. 9. Positional Notation: Octal <ul><li>624 8 = 404 10 </li></ul>Sum for Base 10 Evaluate Value Place 4 x 1 2 x 8 6 x 64 4 16 384 8 0 8 1 8 2 1 8 64 64’s place 8’s place 1’s place
10. 10. Positional Notation: Hexadecimal <ul><li>6,704 16 = 26,372 10 </li></ul>4 x 1 0 x 16 7 x 256 6 x 4,096 Evaluate 4 0 1,792 24,576 Sum for Base 10 16 0 16 1 16 2 16 3 Place 1 16 256 4,096 Value 4,096’s place 256’s place 1’s place 16’s place
11. 11. Positional Notation: Binary 1101 0110 2 = 214 10 Sum for Base 10 Evaluate Value Place 0 x 1 1 x 2 1 x 4 0 x 8 1 x16 0 x 32 1 x 64 1 x 128 0 2 4 0 16 0 64 128 1 2 4 8 16 32 64 128 2 0 2 1 2 2 2 3 2 4 2 5 2 6 2 7
12. 12. Estimating Magnitude: Binary 1101 011 02 = 214 10 1101 011 02 > 192 10 (128 + 64 + additional bits to the right)‏ Sum for Base 10 Evaluate Value Place 0 x 1 1 x 2 1 x 4 0 x 8 1 x16 0 x 32 1 x 64 1 x 128 0 2 4 0 16 0 64 128 1 2 4 8 16 32 64 128 2 0 2 1 2 2 2 3 2 4 2 5 2 6 2 7
13. 13. Range of Possible Numbers <ul><li>R = B K where </li></ul><ul><ul><li>R = range </li></ul></ul><ul><ul><li>B = base </li></ul></ul><ul><ul><li>K = number of digits </li></ul></ul><ul><li>Example #1: Base 10, 2 digits </li></ul><ul><ul><li>R = 10 2 = 100 different numbers (0…99)‏ </li></ul></ul><ul><li>Example #2: Base 2, 16 digits </li></ul><ul><ul><li>R = 2 16 = 65,536 or 64K </li></ul></ul><ul><ul><li>16-bit PC can store 65,536 different number values </li></ul></ul>
14. 14. Decimal Range for Bit Widths 38+ 19+ 9+ 6 4+ 3 2+ 1+ 0+ Digits Approx. 2.6 x 10 38 128 Approx. 1.6 x 10 19 64 4,294,967,296 (4G)‏ 32 1,048,576 (1M)‏ 20 65,536 (64K)‏ 16 1,024 (1K)‏ 10 256 8 16 (0 to 15)‏ 4 2 (0 and 1)‏ 1 Range Bits
15. 15. Base or Radix <ul><li>Base: </li></ul><ul><ul><li>The number of different symbols required to represent any given number </li></ul></ul><ul><li>The larger the base, the more numerals are required </li></ul><ul><ul><li>Base 10 : 0,1, 2,3,4,5,6,7,8,9 </li></ul></ul><ul><ul><li>Base 2 : 0,1 </li></ul></ul><ul><ul><li>Base 8 : 0,1,2, 3,4,5,6,7 </li></ul></ul><ul><ul><li>Base 16 : 0,1,2,3,4,5,6,7,8,9,A,B,C,D,E,F </li></ul></ul>
16. 16. Number of Symbols vs. Number of Digits <ul><li>For a given number, the larger the base </li></ul><ul><ul><li>the more symbols required </li></ul></ul><ul><ul><li>but the fewer digits needed </li></ul></ul><ul><li>Example #1: </li></ul><ul><ul><li>65 16 101 10 145 8 110 0101 2 </li></ul></ul><ul><li>Example #2: </li></ul><ul><ul><li>11C 16 284 10 434 8 1 0001 1100 2 </li></ul></ul>
17. 17. Counting in Base 2 Decimal Number Equivalent Binary Number 10 1 x 2 1 1 x 2 3 1010 9 1 x 2 0 1 x 2 3 1001 8 1 x 2 3 1000 7 1 x 2 0 1 x 2 1 1 x 2 2 111 6 1 x 2 1 1 x 2 2 110 5 1 x 2 0 1 x 2 2 101 4 1 x 2 2 100 3 1 x 2 0 1 x 2 1 11 2 0 x 2 0 1 x 2 1 10 1 1 x 2 0 1 0 0 x 2 0 0 1’s (2 0 )‏ 2’s (2 1 )‏ 4’s (2 2 )‏ 8’s (2 3 )‏
18. 18. Addition Largest Single Digit Problem Base 1 +0 6 +9 6 +1 6 +3 1 Binary F Hexadecimal 7 Octal 9 Decimal
19. 19. Addition Answer Carry Problem Base Carry the 2 Carry the 16 Carry the 8 Carry the 10 10 1 +1 Binary 10 6 +A Hexadecimal 10 6 +2 Octal 10 6 +4 Decimal
20. 20. Binary Arithmetic 1 1 0 0 0 0 0 1 0 1 1 0 1 + 1 0 1 1 0 1 1 1 1 1 1 1
21. 21. Converting from Base 10 <ul><li>Powers Table </li></ul>256 64 4 2 1 16 4,096 65,536 16 1 8 512 4,096 32,768 8 1 2 8 16 32 64 128 256 2 0 1 3 4 5 6 7 8 Power Base
22. 22. From Base 10 to Base 2 10 0 1 0 64 6 42/32= 1 Integer Remainder 1 0 1 0 1 2 4 8 16 32 2 1 2 3 4 5 Power Base 42 10 = 101010 2 10/16 = 0 10 10/8 = 1 2 2/4 = 0 2 2/2 = 1 0 0/1 = 0 0
23. 23. From Base 10 to Base 2 Most significant bit 1 2 )‏ ( 0 2 2 )‏ 42 Base 10 101010 Base 2 ( 1 5 2 )‏ ( 0 10 2 )‏ ( 1 21 2 )‏ ( 0 Least significant bit 42 2 )‏ Remainder Quotient
24. 24. From Base 10 to Base 16 5,735 10 = 1667 16 103 – 96 = 7 1,639 –1,536 = 103 5,735 - 4,096 = 1,639 Remainder 7 103 /16 = 6 1,639 / 256 = 6 5,735 /4,096 = 1 Integer 7 6 6 1 1 16 256 4,096 65,536 16 0 1 2 3 4 Power Base
25. 25. From Base 10 to Base 16 5,735 Base 10 1667 Base 16 0 16 )‏ ( 1 Most significant bit 1 16 )‏ ( 6 22 16 )‏ ( 6 358 16 )‏ ( 7 Least significant bit 5,735 16 )‏ Quotient Remainder
26. 26. From Base 10 to Base 16 8,039 Base 10 1F67 Base 16 0 16 )‏ ( 1 Most significant bit 1 16 )‏ ( 15 31 16 )‏ ( 6 502 16 )‏ ( 7 Least significant bit 8,039 16 )‏ Quotient Remainder
27. 27. From Base 8 to Base 10 3,584 x 7 512 8 3 = 3,763 10 3 48 128 Sum for Base 10 x 3 x 6 x 2 1 8 64 8 0 8 1 8 2 Power 7263 8
28. 28. From Base 8 to Base 10 = 3,763 10 7263 8 + 3 = + 6 = + 2 = 3,763 3760 464 58 x 8 470 x 8 56 7 x 8
29. 29. From Base 16 to Base 2 <ul><li>The nibble approach </li></ul><ul><ul><li>Hex easier to read and write than binary </li></ul></ul><ul><ul><li>Why hexadecimal? </li></ul></ul><ul><ul><ul><li>Modern computer operating systems and networks present variety of troubleshooting data in hex format </li></ul></ul></ul>0111 0110 1111 0001 Base 2 7 6 F 1 Base 16
30. 30. Fractions <ul><li>Number point or radix point </li></ul><ul><ul><li>Decimal point in base 10 </li></ul></ul><ul><ul><li>Binary point in base 2 </li></ul></ul><ul><li>No exact relationship between fractional numbers in different number bases </li></ul><ul><ul><li>Exact conversion may be impossible </li></ul></ul>
31. 31. Decimal Fractions <ul><li>Move the number point one place to the right </li></ul><ul><ul><li>Effect: multiplies the number by the base number </li></ul></ul><ul><ul><li>Example: 139.0 10 1390 10 </li></ul></ul><ul><li>Move the number point one place to the left </li></ul><ul><ul><li>Effect: divides the number by the base number </li></ul></ul><ul><ul><li>Example: 139.0 10 13.9 10 </li></ul></ul>
32. 32. Fractions: Base 10 and Base 2 .101011 2 = 0.671875 10 .2589 10 .008 8 x 1/1000 1/1000 10 -3 .2 2 x 1/10 1/10 10 -1 Sum Evaluate Value Place .0009 .05 9 x1/1000 5 x 1/100 1/10000 1/100 10 -4 10 -2 0 x 1/16 1/16 2 -4 0.03125 1 x 1/32 1/32 2 -5 0.015625 0.125 .5 Sum 1 x 1/64 1x 1/8 0 x 1/4 1 x 1/2 Evaluate 1/64 1/8 1/4 1/2 Value 2 -6 2 -3 2 -2 2 -1 Place
33. 33. Mixed Number Conversion <ul><li>Integer and fraction parts must be converted separately </li></ul><ul><li>Radix point: fixed reference for the conversion </li></ul><ul><ul><li>Digit to the left is a unit digit in every base </li></ul></ul><ul><ul><li>B 0 is always 1 regardless of the base </li></ul></ul>