Presentation is loading. Please wait.

Presentation is loading. Please wait.

Introduction to Computer Science Number Systems. Introduction to Computer Science Common Number Systems SystemBaseSymbols Used by humans? Used in computers?

Similar presentations


Presentation on theme: "Introduction to Computer Science Number Systems. Introduction to Computer Science Common Number Systems SystemBaseSymbols Used by humans? Used in computers?"— Presentation transcript:

1 Introduction to Computer Science Number Systems

2 Introduction to Computer Science Common Number Systems SystemBaseSymbols Used by humans? Used in computers? Decimal100, 1, … 9YesNo Binary20, 1NoYes Octal80, 1, … 7No Hexa- decimal 160, 1, … 9, A, B, … F No

3 Introduction to Computer Science Quantities/Counting (1 of 3) DecimalBinary 00 11 210 311 4100 5101 6110 7111

4 Introduction to Computer Science Quantities/Counting (2 of 3) DecimalBinary 81000 91001 101010 111011 121100 131101 141110 151111

5 Introduction to Computer Science Quantities/Counting (3 of 3) DecimalBinary 1610000 1710001 1810010 1910011 2010100 2110101 2210110 2310111

6 Introduction to Computer Science Conversion Among Bases The possibilities: Hexadecimal DecimalOctal Binary

7 Introduction to Computer Science Decimal to Decimal (just for fun) Hexadecimal DecimalOctal Binary

8 Introduction to Computer Science 125 10 =>5 x 10 0 = 5 2 x 10 1 = 20 1 x 10 2 = 100 125 Base Weight

9 Introduction to Computer Science Binary to Decimal Hexadecimal DecimalOctal Binary

10 Introduction to Computer Science Binary to Decimal Technique –Multiply each bit by 2 n, where n is the “weight” of the bit –The weight is the position of the bit, starting from 0 on the right –Add the results

11 Introduction to Computer Science Example 101011 2 => 1 x 2 0 = 1 1 x 2 1 = 2 0 x 2 2 = 0 1 x 2 3 = 8 0 x 2 4 = 0 1 x 2 5 = 32 43 10 Bit “0”

12 Introduction to Computer Science Decimal to Binary Hexadecimal DecimalOctal Binary

13 Introduction to Computer Science Decimal to Binary Technique –Divide by two, keep track of the remainder –First remainder is bit 0 (LSB, least-significant bit) –Second remainder is bit 1 –Etc.

14 Introduction to Computer Science Example 125 10 = ? 2 2 125 62 1 2 31 0 2 15 1 2 7 1 2 3 1 2 1 1 2 0 1 125 10 = 1111101 2

15 Introduction to Computer Science Common Powers (1 of 2) Base 10 PowerPrefaceSymbol 10 -12 picop 10 -9 nanon 10 -6 micro  10 -3 millim 10 3 kilok 10 6 megaM 10 9 gigaG 10 12 teraT Value.000000000001.000000001.000001.001 1000 1000000 1000000000 1000000000000

16 Introduction to Computer Science Common Powers (2 of 2) Base 2 PowerPrefaceSymbol 2 10 kilok 2 20 megaM 2 30 GigaG Value 1024 1048576 1073741824 What is the value of “k”, “M”, and “G”? In computing, particularly w.r.t. memory, the base-2 interpretation generally applies

17 Introduction to Computer Science Example / 2 30 = In the lab… 1. Double click on My Computer 2. Right click on C: 3. Click on Properties

18 Introduction to Computer Science Review – multiplying powers For common bases, add powers 2 6  2 10 = 2 16 = 65,536 or… 2 6  2 10 = 64  2 10 = 64k a b  a c = a b+c

19 Introduction to Computer Science Binary Addition (1 of 2) Two 1-bit values pp. 36-38 ABA + B 000 011 101 1110 “two”

20 Introduction to Computer Science Binary Addition (2 of 2) Two n-bit values –Add individual bits –Propagate carries –E.g., 10101 21 + 11001 + 25 101110 46 11

21 Introduction to Computer Science Multiplication (2 of 3) Binary, two 1-bit values AB A  B 000 010 100 111

22 Introduction to Computer Science Multiplication (3 of 3) Binary, two n-bit values –As with decimal values –E.g., 1110 x 1011 1110 1110 0000 1110 10011010

23 Introduction to Computer Science Fractions Binary to decimal 10.1011 => 1 x 2 -4 = 0.0625 1 x 2 -3 = 0.125 0 x 2 -2 = 0.0 1 x 2 -1 = 0.5 0 x 2 0 = 0.0 1 x 2 1 = 2.0 2.6875

24 Introduction to Computer Science Fractions Decimal to binary 3.14579.14579 x 2 0.29158 x 2 0.58316 x 2 1.16632 x 2 0.33264 x 2 0.66528 x 2 1.33056 etc. 11.001001...


Download ppt "Introduction to Computer Science Number Systems. Introduction to Computer Science Common Number Systems SystemBaseSymbols Used by humans? Used in computers?"

Similar presentations


Ads by Google