• No results found

NUMBER SYSTEM

N/A
N/A
Protected

Academic year: 2020

Share "NUMBER SYSTEM"

Copied!
88
0
0

Loading.... (view fulltext now)

Full text

(1)
(2)

Number System

• A number system is a systematic way to

represent numbers with symbolic characters. • It uses radix or a base value to conveniently

(3)

Number System

• Provide advantage to

– Mathematicians – Engineers

– Scientists

• Important factor in rapid advancement of modern science technology

(4)

• Earliest numerals consist of either vertical or horizontal lines.

(5)

Unitary System

• Simplest system is not decimal system

(6)
(7)

Decimal System

• Based upon the ten fingers of man. • Following digits are used:

0,1,2,3,4,5,6,7,8,9

(8)

Decimal System

0 10 20 30 40 50 60 …90 100

1 11 . 31

2 12 . .

3 13 . .

4 14 . .

5 15

6 16

7 17

8 18

(9)

Decimal Integers

• A string of decimal digits and a decimal

fraction (a string of decimal digits together with an embedded decimal point.)

• Any decimal integer can be expressed as the sum of each of its digits times a power of

(10)

• Example: 85463

Can be expressed as

= 8x104 + 5x103 + 4x102+6x101 +3x100

= 8x10000 + 5x1000 + 4x100 + 6x10 + 3x1

(11)

• A number raised to a power is called a BASE,

• Hence, 10 is the base of the decimal system. • Base is also known as the RADIX of the

(12)

• It corresponds to the digits in the integer reading from right to left and are called PLACE VALUE.

(13)

• Any decimal fraction may also expressed in

expanded notation, but place values of the digits to the right of the decimal point are the negative

powers of then asL 10-1 or 1/10, 10-2 or 1/100 … • Ex:

736.528

= 7x102+3x101+6x100 + 5x10-1 +2x10-2+8x10-3

= 7x100 +

(14)

BINARY SYSTEM

• Positional numeration system to the base of 2.

• Uses on two symbols: 0 and 1

• Symbol 0 represents the absence of an assigned value

(15)

• Symbols used in binary notation are called BITS

(16)

Power of Two Decimal Value

210 1024

29 512

28 256

27 128

26 64

25 32

24 16

23 8

22 4

21 2

(17)

Decimal – Binary Conversion

• Rule:

• To convert decimal whole numbers from base 10 to any other base, divide that number repeatedly by the value of the base to which the number is being converted. The division operation is

repeated until the quotient is zero. The remainders – written in reverse order in which they were

(18)

Example:

Convert 139 to binary

• Div Quotient Remainders

139/2 69. 1

69/2 34. 1

34/2 17 0

17/2 8. 1

8/2 4 0

4/2 2 0

2/2 1 0

½ 0. 1

Therefore:

(19)

Binary to Decimal Conversion

Ex

101 = 1x22 + 0x21 + 1x20

= 4 + 0 + 1

(20)

Common Number Systems

System Base Symbols

Used by humans?

Used in computers?

Decimal 10 0, 1, … 9 Yes No

Binary 2 0, 1 No Yes

Octal 8 0, 1, … 7 No No

Hexa-decimal

16 0, 1, … 9, A, B, … F

(21)

Quantities/Counting (1 of 3)

Decimal Binary Octal

Hexa-decimal

0 0 0 0

1 1 1 1

2 10 2 2

3 11 3 3

4 100 4 4

5 101 5 5

6 110 6 6

(22)

Quantities/Counting (2 of 3)

Decimal Binary Octal

Hexa-decimal

8 1000 10 8

9 1001 11 9

10 1010 12 A

11 1011 13 B

12 1100 14 C

13 1101 15 D

14 1110 16 E

(23)

Quantities/Counting (3 of 3)

Decimal Binary Octal

Hexa-decimal

16 10000 20 10

17 10001 21 11

18 10010 22 12

19 10011 23 13

20 10100 24 14

21 10101 25 15

22 10110 26 16

(24)

Conversion Among Bases

• The possibilities:

Hexadecima l

Decimal Octal

Binary

(25)

Quick Example

25

10

= 11001

2

= 31

8

= 19

16

(26)

Decimal to Decimal (just for fun)

Hexadecima l

Decimal Octal

Binary

(27)

125

10 => 5 x 10 0

= 5 2 x 101 = 20

1 x 102 = 100 125

Base

(28)

Binary to Decimal

Hexadecima l

Decimal Octal

(29)

Binary to Decimal

• Technique

– Multiply each bit by 2n, where n is the “weight” of the bit

– The weight is the position of the bit, starting from 0 on the right

(30)

Example

101011

2 => 1 x 2 0

= 1

1 x 21 = 2 0 x 22 = 0 1 x 23 = 8 0 x 24 = 0 1 x 25 = 32

4310

(31)

Octal to Decimal

Hexadecima l

Decimal Octal

(32)

Octal to Decimal

• Technique

– Multiply each bit by 8n, where n is the “weight” of the bit

– The weight is the position of the bit, starting from 0 on the right

(33)

Example

7248 => 4 x 80 = 4 2 x 81 = 16

7 x 82 = 448 468

(34)

Hexadecimal to Decimal

Hexadecima l

Decimal Octal

(35)

Hexadecimal to Decimal

• Technique

– Multiply each bit by 16n, where n is the “weight” of the bit

– The weight is the position of the bit, starting from 0 on the right

(36)

Example

ABC

16 => C x 16 0

= 12 x 1 = 12

B x 161 = 11 x 16 = 176

A x 162 = 10 x 256 = 2560

2748

(37)

Decimal to Binary

Hexadecima l

Decimal Octal

(38)

Decimal to Binary

• Technique

– Divide by two, keep track of the remainder

– First remainder is bit 0 (LSB, least-significant bit)

(39)

Example

125

10 = ?2

2 125

62 1 2

31 0 2

15 1 2

7 12 3 1 2

1 1 2

0 1

125

(40)

Octal to Binary

Hexadecima l

Decimal Octal

(41)

Octal to Binary

• Technique

(42)

Example

705

8 = ?2

7 0 5

111 000 101

705

(43)

Hexadecimal to Binary

Hexadecima l

Decimal Octal

(44)

Hexadecimal to Binary

• Technique

(45)

Example

10AF

16 = ?2

1 0 A F

0001 0000 1010 1111

10AF

(46)

Decimal to Octal

Hexadecima l

Decimal Octal

(47)

Decimal to Octal

• Technique

– Divide by 8

(48)

Example

1234

10 = ?8

8 1234

154 2 8

19 2 8

2 3 8

0 2

1234

(49)

Decimal to Hexadecimal

Hexadecima l

Decimal Octal

(50)

Decimal to Hexadecimal

• Technique

– Divide by 16

(51)

Example

1234

10 = ?16

1234

10 = 4D216

16 1234

77 216

4 13 = D 16

(52)

Binary to Octal

Hexadecima l

Decimal Octal

(53)

Binary to Octal

• Technique

(54)

Example

1011010111

2 = ?8

1 011 010 111

1 3 2 7

1011010111

(55)

Binary to Hexadecimal

Hexadecima l

Decimal Octal

(56)

Binary to Hexadecimal

• Technique

(57)

Example

1010111011

2 = ?16

10 1011 1011

(58)

Octal to Hexadecimal

Hexadecima l

Decimal Octal

(59)

Octal to Hexadecimal

• Technique

(60)

Example

1076

8 = ?16

1 0 7 6

001 000 111 110

2 3 E

1076

(61)

Hexadecimal to Octal

Hexadecima l

Decimal Octal

(62)

Hexadecimal to Octal

• Technique

(63)

Example

1F0C

16 = ?8

1 F 0 C

0001 1111 0000 1100

(64)

Exercise – Convert ...

Don’t use a calculator! Decimal Binary Octal

Hexa-decimal 33

1110101

703

1AF

(65)

Exercise – Convert …

Decimal Binary Octal

Hexa-decimal

33 100001 41 21

117 1110101 165 75

451 111000011 703 1C3 431 110101111 657 1AF

(66)

Common Powers (1 of 2)

• Base 10

Power Preface Symbol

10-12 pico p

10-9 nano n

10-6 micro μ

10-3 milli m

103 kilo k

106 mega M

109 giga G

1012 tera T

(67)

Common Powers (2 of 2)

• Base 2

Power Preface Symbol

210 kilo k

220 mega M

230 Giga G

Value 1024 1048576 1073741824

• What is the value of “k”, “M”, and “G”? • In computing, particularly w.r.t. memory,

(68)

Example

/ 230 =

In the lab…

1. Double click on My Computer 2. Right click on C:

(69)

Exercise – Free Space

• Determine the “free space” on all drives on a machine in the lab

Drive

Free space

Bytes GB

(70)

Review – multiplying powers

• For common bases, add powers

26 × 210 = 216 = 65,536

or…

26 × 210 = 64 × 210 = 64k

(71)

Binary Addition (1 of 2)

• Two 1-bit values

A B A + B

0 0 0

0 1 1

1 0 1

1 1 10

(72)

Binary Addition (2 of 2)

• Two n-bit values

– Add individual bits – Propagate carries – E.g.,

10101 21 + 11001 + 25 101110 46

(73)

Multiplication (1 of 3)

• Decimal (just for fun)

(74)

Multiplication (2 of 3)

• Binary, two 1-bit values

A B A × B

0 0 0

0 1 0

1 0 0

(75)

Multiplication (3 of 3)

• Binary, two n-bit values

– As with decimal values – E.g.,

1110 x 1011 1110 1110 0000 1110

(76)

Fractions

• Decimal to decimal (just for fun)

pp. 46-50

3.14 => 4 x 10-2 = 0.04 1 x 10-1 = 0.1

3 x 100 = 3

(77)

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 20 = 0.0 1 x 21 = 2.0

(78)

Fractions

• Decimal to binary

p. 50

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.

(79)

Exercise – Convert ...

Don’t use a calculator!

Decimal Binary Octal

Hexa-decimal 29.8

101.1101

3.07

(80)

Exercise – Convert …

Decimal Binary Octal

Hexa-decimal 29.8 11101.110011… 35.63… 1D.CC…

5.8125 101.1101 5.64 5.D

3.109375 11.000111 3.07 3.1C 12.5078125 1100.10000010 14.404 C.82

(81)

Thank you..

Goodbye class>>.

(82)

Binary Multiplication

Rule: 0 x 0 = 0 1 x 0 = 0 0 x 1 = 0 1 x 1 = 1 Example:

111 – multiplicand 7 x 101 – multiplier 5

111 000 111

(83)

Binary Multiplication

Example:

11.00 – multiplicand 3.0 x 10.10 – multiplier 2.5

0000 150

1100 60

0000 1100

(84)

Binary Division

Rule:

0/1 = 0 1/1 = 1

Example: ___ 1100/100 100 / 1100 quotient= 11

100 divisor

100 100

(85)

1100 - 100 1000 - 100 100 - 100

000 remainder

The solution shows that 3 repeated subtractions were performed. Since the equivalent of 3 in binary is 11

(86)

BINARY ADDITION

Table:

0 + 0 = 0 0 + 1 = 1 1 + 0 = 1

(87)

Example

Binary Decimal 11 3

(88)

BINARY SUBTRACTION

Table: 0 – 0 = 0 1 – 0 = 1 1 - 1 = 0

References

Related documents

Annual case rates for recent entrants were 25 to 30 per 100 000 persons for individuals younger than 5 years of age at arrival in the United States and increased to exceed 100 per

To earn full credit, you must include four topics or behaviors in each blog post.. To earn 20 points

The parasitoid Venturia canescens (Gravenhorst) (Hymenoptera: Ichneumonidae) did not enter the bags, but located host larvae inside the jute bags and parasitized rice moths

A Divide the both number as whole Numbers b Now place the decimal point in the quotient as in the decimal number Division of Decimals by a Whole Number.. This digit problems with

In this research the terms online education, eTeachers and online learning will be used, as the online English language learning programme that is the subject of my study is

First, it investigates the crucial role played by migrant women of the first and second generation to create a safety net for the members of their transnational households, in terms

The Offeror providing the lowest 3 Year Cost to the Consumer for all Call Types and Fees on Page 3 4 of Attachment M will receive a total score of 55.. All other Offerors will

To convert a decimal number into its octal equivalent, the same procedure is adopted as in decimal to binary conversion but the decimal number is divided by 8 (the base of the