36
FLIPPED CLASS F#3- Number System Department of CSE, Coimbatore 1 CTPS 2018

FLIPPED CLASS...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 The decimal

  • Upload
    others

  • View
    5

  • Download
    0

Embed Size (px)

Citation preview

Page 1: FLIPPED CLASS...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 The decimal

FLIPPED CLASS

F#3- Number System

Department of CSE, Coimbatore 1CTPS 2018

Page 2: FLIPPED CLASS...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 The decimal

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-

decimal16

0, 1, … 9,

A, B, … FNo No

2Department of CSE, Coimbatore

Page 3: FLIPPED CLASS...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 The decimal

The decimal system (base 10)

• The word decimal is derived from the Latin root decem (ten). In this

system the base b = 10 and we use ten symbols.

• The symbols in this system are often referred to as decimal digits or

just digits.

S = {0, 1, 2, 3, 4, 5, 6, 7, 8, 9}

3Department of CSE, Coimbatore

Page 4: FLIPPED CLASS...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 The decimal

Integers

• Integers are generally represented in the form as …

Eg.

• The place values for the integer number +24 is …

4Department of CSE, Coimbatore

Page 5: FLIPPED CLASS...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 The decimal

Real Numbers

• Real Numbers are generally represented in the form as …

Eg.

• The place values for the real number +24.13 is …

5Department of CSE, Coimbatore

Page 6: FLIPPED CLASS...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 The decimal

The binary system (base 2)

• The word binary is derived from the Latin root bini(or two by two).

• In this system the base b = 2 and we use only two symbols.

• The symbols in this system are often referred to as binary digits or bits(binary digit).

6

S = {0, 1}

Department of CSE, Coimbatore

Page 7: FLIPPED CLASS...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 The decimal

Decimal to Binary Conversion

• The number (156)10 in decimal is the same as (10011100)2 in binary.

• Let us see how the conversion is done!

Department of CSE, Coimbatore 7

Page 8: FLIPPED CLASS...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 The decimal

Decimal to Binary Conversion Cntd..

• If the decimal number to be converted is (156.6875)10 , let us see how the

fractional part can be converted to binary!

Department of CSE, Coimbatore 8

Page 9: FLIPPED CLASS...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 The decimal

• If the decimal number to be converted is (156.6875)10 , let us see how the fractional part

can be converted to binary!

• The binary of (156)10 is (10011100)2 and the binary of (0.6875)10 is (0.1011)2

So the complete answer is (156.6875)10 = (10011100.1011)2

Department of CSE, Coimbatore 9

Page 10: FLIPPED CLASS...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 The decimal

• The number (11001)2 in binary is the same as 25 in decimal and is represented as…

• The equivalent decimal number is N = 16 + 8 + 0 + 0 + 1 = 25.

Department of CSE, Coimbatore 10

Page 11: FLIPPED CLASS...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 The decimal

• The number (101.11)2 in binary is equal to the number 5.75 in decimal .

Department of CSE, Coimbatore 11

Page 12: FLIPPED CLASS...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 The decimal

✓Can you perform the indicated conversion?

Department of CSE, Coimbatore

Decimal to Binary

a) 1310 = ?

b) 2210 = ?

c) 4310 = ?

d) 15810 = ?

Binary to Decimal

a) 0110 2 = ?

b) 11010 2 = ?

c) 0110101 2 = ?

d) 11010011 2 = ?

12

Page 13: FLIPPED CLASS...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 The decimal

Decimal → Binary ………..Answers

a) 1310 = ?

b) 2210 = ?

c) 4310 = ?

d) 15810 = ?

1 1 0 1 2

1 0 1 1 0 2

1 0 1 0 1 1 2

1 0 0 1 1 1 1 0 2

Department of CSE, Coimbatore 13

Page 14: FLIPPED CLASS...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 The decimal

Binary → Decimal ……….Answers

a) 0110 2 = ?

b) 11010 2 = ?

c) 0110101 2 = ?

d) 11010011 2 = ?

6 10

26 10

53 10

211 10

Department of CSE, Coimbatore 14

Page 15: FLIPPED CLASS...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 The decimal

The hexadecimal system (base 16)

• The word hexadecimal is derived from the Greek root hex (six) and the Latin root decem (ten).

• In this system the base b = 16 and we use sixteen symbols to represent a number.

• The set of symbols are:

Note that the symbols A, B, C, D, E, F are equivalent to 10, 11, 12, 13, 14, and 15 respectively.

The symbols in this system are often referred to as hexadecimal digits.

S = {0, 1, 2, 3, 4, 5, 6, 7, 8, 9,A, B, C, D, E, F}

Department of CSE, Coimbatore 15

Page 16: FLIPPED CLASS...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 The decimal

• The number (2AE)16 in hexadecimal is equivalent to 686 in decimal is represented as…

• The equivalent decimal number is N = 512 + 160 + 14 = 686.Department of CSE, Coimbatore 16

Page 17: FLIPPED CLASS...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 The decimal

Converting from base 10 to base 3

3 4 10 = __________3

33 32 3 1

3 3 4

1 1 - 13

3 - 23

1 - 0

1 0 2 1

Department of CSE, Coimbatore 17

Page 18: FLIPPED CLASS...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 The decimal

Decimal to any base – Integral part

Department of CSE, Coimbatore 18

Page 19: FLIPPED CLASS...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 The decimal

Decimal to any base – Fractional part

Department of CSE, Coimbatore 19

Page 20: FLIPPED CLASS...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 The decimal

Binary-octal (base 8) conversion

• The binary bits are grouped into 3 and converted….

• Binary to octal and octal to binary conversion. Eg.

Department of CSE, Coimbatore 20

Page 21: FLIPPED CLASS...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 The decimal

Binary-hexadecimal conversion

Department of CSE, Coimbatore

• The binary bits are grouped into 4 and converted…

• Binary to hexadecimal and hexadecimal to binary conversion. Eg.

21

Page 22: FLIPPED CLASS...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 The decimal

Octal (base 8)-hexadecimal conversion

• Convert into binary first and then perform the required conversion.

• Octal to hexadecimal and hexadecimal to octal conversion. Eg.

Department of CSE, Coimbatore 22

Page 23: FLIPPED CLASS...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 The decimal

Try it yourself✓Convert these binary numbers into octal numbers...

(a) 001011112 (8 bits) (b) 111101002 (8 bits)

✓Convert the following octal numbers into hexadecimal (16 bits)

(a) 658 (b) 1238

Can you find out .........

✓What is the biggest binary number one can write with n bits?

✓How many unique patterns does a sequence of 5 bits generate?

✓Write all the patterns of a sequence of 5 bits.Department of CSE, Coimbatore 23

Page 24: FLIPPED CLASS...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 The decimal

Try it yourself

Department of CSE, Coimbatore

✓Convert these binary numbers into octal numbers...

(a) 001011112 (8 bits) (b) 111101002 (8 bits)

✓Convert the following octal numbers into hexadecimal (16 bits)

(a) 658 (b) 1238

Can you find out .........

✓What is the biggest binary number one can write with n bits?

✓How many unique patterns does a sequence of 5 bits generate?

✓Write all the patterns of a sequence of 5 bits.

24

Page 25: FLIPPED CLASS...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 The decimal

Binary → Octal ........ Answers

Refer to the binary-octal

conversion table

000 101 111

= 578

0 5 7

Refer to the binary-octal

conversion table

011 110 100

= 3648

3 6 4

Department of CSE, Coimbatore 25

Page 26: FLIPPED CLASS...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 The decimal

Refer to the binary-octal conversion table

68 58

110 101

0000 0000 0011 01012

0 0 3 5

= 3516

Refer to the binary-octal conversion table

18 28 38

001 010 011

0000 0000 0101 00112

0 0 5 3

= 5316

Octal → Hexadecimal Answers

Department of CSE, Coimbatore 26

Page 27: FLIPPED CLASS...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 The decimal

Conversion from Hexadecimal to Binary

Replace each hex digit by the 4 equivalent bits, for examples,

• A3C5H = 1010 0011 1100 0101B

• 102AH = 0001 0000 0010 1010B

27Department of CSE, Coimbatore

Page 28: FLIPPED CLASS...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 The decimal

Conversion from Binary to Hexadecimal

Starting from the right-most bit (least-significant bit), replace each group of 4 bits by

the equivalent hex digit (pad the left-most bits with zero if necessary), for example,

• 1001001010B = 0010 0100 1010B = 24AH

• 10001011001011B = 0010 0010 1100 1011B = 22CBH

28Department of CSE, Coimbatore

Page 29: FLIPPED CLASS...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 The decimal

Exercises (Number Systems Conversion)

Convert the following decimal numbers into binary and hexadecimal numbers:

• 108

• 4848

• 9000

29

Page 30: FLIPPED CLASS...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 The decimal

Answers……………

• 108 = 1101100 = 6C

• 4848 = 1001011110000 = 12F0

• 9000 = 10001100101000 = 2328

Depart

ment

of

CSE,

Coimb

atore

30

Page 31: FLIPPED CLASS...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 The decimal

Exercises (Number Systems Conversion)

Convert the following binary numbers into hexadecimal and decimal numbers:

• 1000011000

• 10000000

• 101010101010

31

Page 32: FLIPPED CLASS...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 The decimal

Answers……………

• 1000011000 = 218H = 536D

• 10000000 = 80H = 128D

• 101010101010 = AAAH = 2730D

Depart

ment

of

CSE,

Coimb

atore

32

Page 33: FLIPPED CLASS...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 The decimal

Exercises (Number Systems Conversion)

Convert the following hexadecimal numbers into binary and decimal numbers:

• ABCDE

• 1234

• 80F

33

Page 34: FLIPPED CLASS...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 The decimal

Answers……………

• ABCDE = 10101011110011011110 = 703710D

• 1234 = 1001000110100 = 4660D

• 80F = 100000001111 = 2063D

34

Page 35: FLIPPED CLASS...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 The decimal

Exercises (Number Systems Conversion)

Convert the following decimal numbers into binary equivalent:

• 19.25D

• 123.456D

35

Page 36: FLIPPED CLASS...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 The decimal

Answers……………

• 19.25 = 10011.01

• 123.456 = 1111011.01110100…

Depart

ment

of

CSE,

Coimb

atore

36