33
Number Systems (Class XI) Nita Arora (KHMS) PGT Comp. Sc.

Number System

Embed Size (px)

DESCRIPTION

number system

Citation preview

Page 1: Number System

Number Systems (Class XI)

Nita Arora (KHMS)PGT Comp. Sc.

Page 2: Number System

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 betweenon/off switches and calculation using Boolean logic

01

NoYes

FalseTrue

OffOn

Page 3: Number System

Number Systems 2-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: 1010 = A16; 1110 = B16

Page 4: Number System

Number Systems 2-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

Page 5: Number System

Number Systems 2-5

Numbers: Physical Representation

Different numerals, same number of oranges Cave dweller: IIIII Roman: V Arabic: 5

Different bases, same number of oranges 510

1012

123

Page 6: Number System

Number Systems 2-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

Page 7: Number System

Number Systems 2-7

Positional Notation: Base 10

Sum

Evaluate

Value

Place

340

3 x14 x 10

110

100101

1’s place10’s place

43 = 4 x 101 + 3 x 100

Page 8: Number System

Number Systems 2-8

Positional Notation: Base 10

500

5 x 100

100

102

Sum

Evaluate

Value

Place

720

7 x12 x 10

110

100101

1’s place10’s place

527 = 5 x 102 + 2 x 101 + 7 x 100

100’s place

Page 9: Number System

Number Systems 2-9

Positional Notation: Octal

6248 = 40410

Sum for Base 10

Evaluate

Value

Place

4 x 12 x 86 x 64

416384

808182

1864

64’s place 8’s place 1’s place

Page 10: Number System

Number Systems 2-10

Positional Notation: Hexadecimal

6,70416 = 26,37210

4 x 10 x 167 x 2566 x

4,096

Evaluate

401,79224,576Sum for Base 10

160161162163Place

1162564,096Value

4,096’s place 256’s place 1’s place16’s place

Page 11: Number System

Number Systems 2-11

Positional Notation: Binary

Sum for Base 10

Evaluate

Value

Place

0 x 11 x 21 x 40 x 81 x160 x 321 x 641 x 128

024016064128

1248163264128

2021222324252627

1101 01102 = 21410

Page 12: Number System

Number Systems 2-12

Estimating Magnitude: Binary

1101 01102 = 21410

1101 01102 > 19210 (128 + 64 + additional bits to the right)

Sum for Base 10

Evaluate

Value

Place

0 x 11 x 21 x 40 x 81 x160 x 321 x 641 x 128

024016064128

1248163264128

2021222324252627

Page 13: Number System

Number Systems 2-13

Range of Possible Numbers

R = BK where R = range B = base K = number of digits

Example #1: Base 10, 2 digits R = 102 = 100 different numbers (0…99)

Example #2: Base 2, 16 digits R = 216 = 65,536 or 64K 16-bit PC can store 65,536 different number

values

Page 14: Number System

Number Systems 2-14

Decimal Range for Bit Widths

38+

19+

9+

6

4+

3

2+

1+

0+

Digits

Approx. 2.6 x 1038128

Approx. 1.6 x 101964

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

RangeBits

Page 15: Number System

Number Systems 2-15

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

Page 16: Number System

Number Systems 2-16

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: 6516 10110 1458 110 01012

Example #2: 11C1628410 4348 1 0001 11002

Page 17: Number System

Number Systems 2-17

Counting in Base 2

Decimal

Number

EquivalentBinary

Number

101 x 211 x 231010

91 x 201 x 231001

81 x 231000

71 x 201 x 211 x 22111

61 x 211 x 22110

51 x 201 x 22101

41 x 22100

31 x 201 x 2111

20 x 201 x 2110

11 x 201

00 x 200

1’s (20)2’s (21)4’s (22)8’s (23)

Page 18: Number System

Number Systems 2-18

Addition

Largest Single DigitProblemBase

1

+0

6

+9

6

+1

6

+3

1Binary

FHexadecimal

7Octal

9Decimal

Page 19: Number System

Number Systems 2-19

Addition

AnswerCarryProblemBase

Carry the 2

Carry the 16

Carry the 8

Carry the 10

10 1

+1Binary

10 6

+AHexadecimal

10 6

+2Octal

10 6

+4Decimal

Page 20: Number System

Number Systems 2-20

Binary Arithmetic

11000001

01101+

101101111111

Page 21: Number System

Number Systems 2-21

Converting from Base 10

256

64

4

2

1164,09665,53616

185124,09632,7688

1281632641282562

01345678 Power

Base

Powers Table

Page 22: Number System

Number Systems 2-22

From Base 10 to Base 2

0

1

0

64

6

42/32= 1

Integer

Remainder

10101

24816322

12345 Power

Base

4210 = 1010102

10/16 = 0

10

10/8 = 1

2

2/4 = 0

2

2/2 = 1

0

0/1 = 0

010

Page 23: Number System

Number Systems 2-23

From Base 10 to Base 2

Most significant bit12 )

( 022 )

42Base 10

101010Base 2

( 152 )

( 0102 )

( 1 212 )

( 0 Least significant bit422 )

Remainder

Quotient

Page 24: Number System

Number Systems 2-24

From Base 10 to Base 16

5,73510 = 166716

103 – 96 = 7

1,639 –1,536 = 103

5,735 - 4,096 = 1,639

Remainder

7103 /16 = 6

1,639 / 256 = 6

5,735 /4,096 = 1

Integer

7661

1162564,09665,53616

01234Power

Base

Page 25: Number System

Number Systems 2-25

From Base 10 to Base 16

5,735Base 10

1667Base 16

016 )

( 1 Most significant bit116 )

( 62216 )

( 635816 )

( 7 Least significant bit5,73516 ) Quotient

Remainder

Page 26: Number System

Number Systems 2-26

From Base 10 to Base 16

8,039Base 10

1F67Base 16

016 )

( 1 Most significant bit116 )

( 153116 )

( 650216 )

( 7 Least significant bit8,03916 ) Quotient

Remainder

Page 27: Number System

Number Systems 2-27

From Base 8 to Base 10

3,584

x 7

512

83

= 3,76310

348128Sum for Base 10

x 3x 6 x 2

1864

808182Power

72638

Page 28: Number System

Number Systems 2-28

From Base 8 to Base 10

= 3,7631072638

+ 3 =

+ 6 =

+ 2 =

3,7633760

464

58

x 8

470

x 8

56

7

x 8

Page 29: Number System

Number Systems 2-29

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

0111011011110001Base 2

76F1Base 16

Page 30: Number System

Number Systems 2-30

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

Page 31: Number System

Number Systems 2-31

Decimal Fractions

Move the number point one place to the right Effect: multiplies the number by the base number Example: 139.010 139010

Move the number point one place to the left Effect: divides the number by the base number Example: 139.010 13.910

Page 32: Number System

Number Systems 2-32

Fractions: Base 10 and Base 2

.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/10005 x 1/100

1/100001/100

10-410-2

.1010112 = 0.67187510

0 x 1/16

1/16

2-4

0.03125

1 x 1/32

1/32

2-5

0.0156250.125.5Sum

1 x 1/641x 1/80 x 1/41 x 1/2Evaluate

1/641/81/41/2Value

2-62-32-22-1Place

.258910

Page 33: Number System

Number Systems 2-33

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 B0 is always 1 regardless of the base