computer number systems. d n-1 d n-2 d n-3 --- d 2-m d 1-m d -m conventional radix number r is the...

34
Computer Number Systems

Upload: stuart-palmer

Post on 31-Dec-2015

219 views

Category:

Documents


3 download

TRANSCRIPT

Computer Number Systems

dn-1dn-2dn-3 --- d2-md1-md-m

Conventional Radix Number

r is the radix di is a digit

di Є {0, 1, ….. , r – 1 }

-m ≤ i < n

dn-1dn-2dn-3 --- d2d1d0

Conventional Radix Number (Integer Part)

r is the radix di is a digit

di Є {0, 1, ….. , r – 1 }

0 ≤ i < n

.d-1d-2d-3 --- dmd1-md-m

Conventional Radix Number (Fraction Part)

r is the radix di is a digit

di Є {0, 1, ….. , r – 1 }

0 ≤ i < n

N = dn-1wn-1 + dn-2wn-2 + --- + d1-mw-m

The Conventional Number System is a Positional Weighted System

N = ∑ di . wi

Most Significant Digit & Least Significant Digit

MSD corresponds to digit with maximum weightLSD corresponds to digit with minimum weight

dn-1dn-2dn-3 --- d2-md1-md-m

MSDMost Significant Digit

LSDLeast Significant Digit

bn-1bn-2bn-3 --- b2-mb1-mb-m

MSBMost Significant Bit

LSBLeast Significant Bit

For all Number Systems

For the Binary Number System

N = dn-1wn-1 + dn-2wn-2 + ---- + d-mw-m

The Conventional Number System is a Positional Weighted System

N = ∑ di . wi

In a Fixed-Radix Number Systemwi = ri

N = ∑ di . wi => N = ∑ di . ri

N = ∑ di . ri

Examples

(7051)10 = 7 x 103 + 0 x 102 + 5 x 101 + 1 x 100

= 7000 + 000 + 50 + 1 = 7051

(.27)10 = 2 x 10-1 + 7 x 10-2

= .2 + .07 = .27

(34.903)10 = 3 x 101 + 4 x 100 + 9 x 10-1 + 0 x 10-2 + 3 x 10-3

= 31 + 4 + .9 + .00 + .003 = 34.903

Decimal Number System : Radix 10di = {0, 1, 2, 3, 5, 6, 7, 8, 9}

Examples

(7051)8 = 7 x 83 + 0 x 82 + 5 x 81 + 1 x 80

=

(.27)8 = 2 x 8-1 + 7 x 8-2

=

(34.903)8 = 3 x 81 + 4 x 80 + 9 x 8-1 + 0 x 8-2 + 3 x 8-3

=

Octal Number System : Radix 8di = {0, 1, 2, 3, 5, 6, 7}

Examples

(72A)16 = 7 x 162 + 2 x 161 + 10 x 160

=

(.CF1)16 = 12 x 16-1 + 15 x 16-2 + 1 x 16-3

=

(3B.2D)16 = 3 x 161 + 11 x 160 + 2 x 16-1 + 13 x 16-2

=

Hexadecimal Number System : Radix 16di = {0, 1, 2, 3, 4, 5, 6, 7, 8, 9, A, B, C, D, E, F}

Examples

(101)2 = 1 x 22 + 0 x 21 + 1 x 20

= 4 + 0 + 1 = 5

(.0101)2 = 0 x 2-1 + 1 x 2-2 + 1 x 2-3 + 0 x 2-4

= 0 + .25 + 0 + .06125 = .31125

(10.101)2 = 1 x 21 + 1 x 20 + 1 x 2-1 + 0 x 2-2 + 1 x 2-3

= 2 + 0 + .5 + 0 + .25 = 2.75

Binary Number System : Radix 2di = {0, 1}

Base Conversion

Integer Part

Base Conversion

Fraction Part

Base Conversion

Both Integer and Fraction Part

Representation of Signed Numbers

Integer Part

(an) an-1an-2an-3 --- a2a1a0

Sign of a n-Digit Signed Number

The (n+1)th digit an is the sign digit

0 if A ≥ 0r- 1 if A < 0

an =

Magnitude of a n-Digit Signed Number

There are 3 different ways to represent the magnitude

Sign Magnitude Form (SMF)Diminished Radix Complement Form (DRC)

Radix Complement Form (RC)

DRC is also known as (r-1)’s complementRC is also known as r’s complement

SMF(0) an-1 an-2 --- a2 a1 a0

DRC (0) an-1 an-2 --- a2 a1 a0

RC (0) an-1 an-2 --- a2 a1 a0

If A is a positive number [ A ≥ 0 ]

SMF(r-1) an-1 an-2 --- a2 a1 a0

DRC(r-1) ān-1 ān-2 --- ā2 ā1 ā0

RC (r-1) ān-1 ān-2 --- ā2 ā1 ā0 + 1

where, āi = (r-1) - ai

r = radix

If A is a negative number [ A < 0 ]

ān-1 ān-2 ---- ā2 ā1 ā0

an-1 an-2 ---- a2 a1 a0 (r-1)n-1 (r-1)n-2 ---- (r-1)2 (r-1)1 (r-1)0

The āi notation is implicative of

Addition

Addition

Subtraction

Subtraction