chapter 2 number systems consists of a set of symbols called digits and a set of relations such as...

11
Chapter 2 Number Systems Consists of a set of symbols called digits and a set of relations such as +, -, x, /.

Upload: leon-harvey

Post on 18-Jan-2016

217 views

Category:

Documents


2 download

TRANSCRIPT

Page 1: Chapter 2 Number Systems Consists of a set of symbols called digits and a set of relations such as +, -, x,

Chapter 2Number Systems

Consists of a set of symbols called digits and a set of relations such as +, -, x, /.

Page 2: Chapter 2 Number Systems Consists of a set of symbols called digits and a set of relations such as +, -, x,

RADIX OR BASE

The total number of digits is the radix, or base of the system. Each position in the numberis a power of the base. The power starts at 0 and increases by one as we move eachposition to the left of the radix point, and decreases by one as we move to the right of theradix point.

Example: decimal number 2351.2318

---------------------------------------------------- 2 3 5 1 . 2 3 1 8 ---------------------------------------------------- 10^3 10^2 10^1 10^0 10^-1 10^-2 10^-3 10^-4

powers increase by one powers decrease by one

10^3 X 2 = 2000 10^-1 X 2 = .2 10^2 X 3 = 300 10^-2 X 3 = .03 10^1 X 5 = 50 10^-3 X 1 = .001 10^0 X 1 = 1 10^-4 X 8 = .0008 = 2351.2318

Page 3: Chapter 2 Number Systems Consists of a set of symbols called digits and a set of relations such as +, -, x,

BINARY NUMBER SYSTEM

In the binary number system the radix is 2. The BInary digiTS (bits) can take on thevalues 0 or 1

--------------------------------------------------- 1 1 0 1 0 . 1 1 0 1 --------------------------------------------------- 2^4 2^3 2^2 2^1 2^0 2^-1 2^-2 2^-3 2^-4

2^4 X 1 = 16 2^-1 X 1 = .5 2^3 X 1 = 8 2^-2 X 1 = .25 2^2 X 0 = 0 2^-3 X 0 = 0 2^1 X 1 = 2 2^-4 X 1 = .0625 2^0 X 0 = 0 = 26.8125

Since each bit can have the values of 0 or 1, with two bit positions we can derive four(2^2) distinct patterns. In general, with n bits it is possible to have 2^n combinations of0's and 1's, these combinations can take on the decimal values of 0 through (2^n - 1).

Page 4: Chapter 2 Number Systems Consists of a set of symbols called digits and a set of relations such as +, -, x,

BINARY/DECIMAL

Binary value Decimal value ---------------------------------------

2^0 1 2^1 2 2^2 4 2^3 8 2^4 16 2^5 32 2^6 64 2^7 128 2^8 256 2^9 512 2^10 1024 ----------> 1 K 2^12 4096 2^16 65536 ----------> 64 K 2^20 1,048,576 ----------> 1 Megabyte 2^24 16,777,216 2^30 1.0737 E9 -------- > 1 Gigabyte 1,000 M 2^32 4.095 E9 2^40 1.0995 E12 --------- > 1 Terabyte 1,000 G

Page 5: Chapter 2 Number Systems Consists of a set of symbols called digits and a set of relations such as +, -, x,

OCTAL NUMBER SYSTEM

In the octal number system the radix is 8. The digits can take the values of 0,1,2,3,4,5,6or 7. ----------------------------------------------------- 4 7 5 . 3 4 ----------------------------------------------------- 8^2 8^1 8^0 8^-1 8^-2

8^2 X 4 = 256 8^-1 X 3 = .375 8^1 X 7 = 56 8^-2 X 4 = .0625 8^0 X 5 = 5 = 317.4375

Using the octal number system, with an n digit number there are 8 different combinationsof digits possible. Which means 8 different numbers can be represented in the range of 0through (8^n - 1).

Page 6: Chapter 2 Number Systems Consists of a set of symbols called digits and a set of relations such as +, -, x,

HEXIDECIMAL SYSTEM

This number system has a radix of 16, so 16 digits are needed. For this system thenumbers 0 - 9 are used and the letters A,B,C,D,E and F are used to represent the numbers10 - 15.

--------------------------------------------- 4 B E 1 . C 3 --------------------------------------------- 16^3 16^2 16^1 16^0 16^-1 16^-2

16^3 X 4 = 16384 16^-1 X C(12) = .75 16^2 X B(11) = 2816 16^-2 X 3 = .0117188 16^1 X E(14) = 224 16^0 X 1 = 1 = 19425.7617188

Since each digit can have 16 different values with n digits there can be 16^n differentnumbers in the range 0 through (16^n - 1).

In general, for any number system of radix (base) R, having n digits, there will be R^ndifferent combinations having the values 0 through (R^n - 1). Also, the maximum valuethat a number can have is R^n - 1.

Page 7: Chapter 2 Number Systems Consists of a set of symbols called digits and a set of relations such as +, -, x,

IntegersBinary -> Decimal

(1 0 1 1)2 = ( ( (1 x 2 + 0) x 2 + 1) x 2) + 1

= (1x22 + 0x2 + 1) x 2 + 1

= (1x23 + 0x22 + 1x2) + 1

= 1x23 + 0x22 + 1x21 + 1x20

= 1x8 + 0x4 + 1x2 + 1x1 = 8 + 0 + 2 + 1 = 11

Page 8: Chapter 2 Number Systems Consists of a set of symbols called digits and a set of relations such as +, -, x,

IntegersBase -> Decimal

Result <- Most Significant Digit Multiply Result by Base and add

next digit to right Repeat step 2 until least significant

digit has been addedExample: (672)8 == (442)10

Page 9: Chapter 2 Number Systems Consists of a set of symbols called digits and a set of relations such as +, -, x,

IntegersDecimal -> Base

Result <- Decimal Number Divide Result by Base and save

remainder Result <- Quotient Repeat step 2 until no more quotientsExample: (442)10 == (672)8

Page 10: Chapter 2 Number Systems Consists of a set of symbols called digits and a set of relations such as +, -, x,

FractionsDecimal -> Base

Result <- Decimal Number Multiply Result by Base and save whole

number Result <- Fraction Repeat step 2 until no fractions or

significance exceededExample: (0.62)10 == (0.4753)8

Page 11: Chapter 2 Number Systems Consists of a set of symbols called digits and a set of relations such as +, -, x,

FractionsBase -> Decimal

Divisor <- Denominator of LSD Treat Fraction as a whole number (that

is, ignore decimal point) and convert Divide the result by the Divisor of Step 1Example: (0.4753)8 == (0.619873)10