Department of Management School of Business, Economics and Informatics Binary Numbers 2 Eva Szatmari...

28
Department of Management School of Business, Economics and Informatics Binary Numbers 2 Eva Szatmari [email protected]

Transcript of Department of Management School of Business, Economics and Informatics Binary Numbers 2 Eva Szatmari...

Page 1: Department of Management School of Business, Economics and Informatics Binary Numbers 2 Eva Szatmari e.szatmari@bbk.ac.uk.

Department of ManagementSchool of Business, Economics and Informatics

Binary Numbers 2Eva Szatmari

[email protected]

Page 2: Department of Management School of Business, Economics and Informatics Binary Numbers 2 Eva Szatmari e.szatmari@bbk.ac.uk.

Learning Objectives

• Recap BIN• Fractions in BIN• Two’s complement notation• Excess notation• Floating point notation

Page 3: Department of Management School of Business, Economics and Informatics Binary Numbers 2 Eva Szatmari e.szatmari@bbk.ac.uk.

Video Tutorials

http://bbk.libguides.com/computerscience/mathstutorials

http://www.bbk.ac.uk/mathstutorials/

https://www.youtube.com/playlist?list=PL2Fy-5oxIlb6cG15wxnhRdAmdskil_3-7

Warning: floating point notation!

Page 4: Department of Management School of Business, Economics and Informatics Binary Numbers 2 Eva Szatmari e.szatmari@bbk.ac.uk.

Recap BIN

• What are BIN nos?• How do we convert BIN to DEC?• How do we convert DEC to BIN?

Page 5: Department of Management School of Business, Economics and Informatics Binary Numbers 2 Eva Szatmari e.szatmari@bbk.ac.uk.

Fractions in BIN

Example 1:11.101

Example 2: 1010.1101

Page 6: Department of Management School of Business, Economics and Informatics Binary Numbers 2 Eva Szatmari e.szatmari@bbk.ac.uk.

Fractions in BIN

Example 1:5 ¼

Example 2:7 ¾

Example 3:2

Page 7: Department of Management School of Business, Economics and Informatics Binary Numbers 2 Eva Szatmari e.szatmari@bbk.ac.uk.

Fractions in BIN

a) 101.0011b) 1100.101

c) 7 d) 12

Page 8: Department of Management School of Business, Economics and Informatics Binary Numbers 2 Eva Szatmari e.szatmari@bbk.ac.uk.

Fractions in BIN

a) 101.0011 = 5 b) 1100.101 = 12

c) 7 = 111.0111d) 12 = 1100.11

Page 9: Department of Management School of Business, Economics and Informatics Binary Numbers 2 Eva Szatmari e.szatmari@bbk.ac.uk.

Two’s Complement Notation

Negative numbers in BIN?Two’s complementSign bit, distinguishing between negative and positive numbersWhat is 0 represented as in two’s complement notation?

Page 10: Department of Management School of Business, Economics and Informatics Binary Numbers 2 Eva Szatmari e.szatmari@bbk.ac.uk.

Two’s Complement Notation

First fix the number of digits, e.g.: 4 bitsFind the positive BIN equivalentCopy all digits from right to left till a 1 had been copiedComplement (invert/flip) the rest of the digits

Page 11: Department of Management School of Business, Economics and Informatics Binary Numbers 2 Eva Szatmari e.szatmari@bbk.ac.uk.

Two’s Complement Notation

4 bits two’s complementExample 1: Example 2:-2 -4

6 bits two’s complementExample 3: Example 4:100100 011001

Page 12: Department of Management School of Business, Economics and Informatics Binary Numbers 2 Eva Szatmari e.szatmari@bbk.ac.uk.

Two’s Complement Notation

5 bits two’s complement:a) – 8 b) – 13

c) 10101d) 11010

Page 13: Department of Management School of Business, Economics and Informatics Binary Numbers 2 Eva Szatmari e.szatmari@bbk.ac.uk.

Two’s Complement Notation

5 bits two’s complement:a) – 8 = 11000b) – 13 = 10011

c) 10101 = - 11 d) 11010 = - 5

Page 14: Department of Management School of Business, Economics and Informatics Binary Numbers 2 Eva Szatmari e.szatmari@bbk.ac.uk.

Excess Notation

Another way of representing negative numbers in BINWhat is 0 represented as in excess notation?What positive numbers look like?What negative numbers look like?How many digits do you use?

Page 15: Department of Management School of Business, Economics and Informatics Binary Numbers 2 Eva Szatmari e.szatmari@bbk.ac.uk.

Excess Notation

4 bits excess:Example 1: Example 2:- 7 - 5

Example 3: Example 4:4 2

Page 16: Department of Management School of Business, Economics and Informatics Binary Numbers 2 Eva Szatmari e.szatmari@bbk.ac.uk.

Excess Notation

4 bits excess:a) - 6b) - 1c) 5d) 7

Page 17: Department of Management School of Business, Economics and Informatics Binary Numbers 2 Eva Szatmari e.szatmari@bbk.ac.uk.

Excess Notation

4 bits excess:a) - 6 = 0001b) - 1 = 0111c) 5 = 1101d) 7 = 1111

Page 18: Department of Management School of Business, Economics and Informatics Binary Numbers 2 Eva Szatmari e.szatmari@bbk.ac.uk.

Floating Point Notation

s e1e2e3 m1m2m3m4

What does this sequence mean?What is s?What are e1e2e3?What are m1m2m3m4?

Page 19: Department of Management School of Business, Economics and Informatics Binary Numbers 2 Eva Szatmari e.szatmari@bbk.ac.uk.

Floating Point Notation

NormalizationExample 1:0.0011001Exponent: Mantissa:Example 2:101.10010Exponent: Mantissa:

Page 20: Department of Management School of Business, Economics and Informatics Binary Numbers 2 Eva Szatmari e.szatmari@bbk.ac.uk.

Floating Point Notation

Step1: identify the sign bit (0 for +, 1 for – numbers)Step 2: find the mantissa (move the radix point to 0.1… format, record the first 4 digits after the point) Step 3: find the exponent in 3 bits excess notationStep 4: record the number:s e1e2e3 m1m2m3m4

Page 21: Department of Management School of Business, Economics and Informatics Binary Numbers 2 Eva Szatmari e.szatmari@bbk.ac.uk.

Floating Point Notation

Example 1: Example 2:

Example 3: Example 4:

Page 22: Department of Management School of Business, Economics and Informatics Binary Numbers 2 Eva Szatmari e.szatmari@bbk.ac.uk.

Floating Point Notation

a)

Page 23: Department of Management School of Business, Economics and Informatics Binary Numbers 2 Eva Szatmari e.szatmari@bbk.ac.uk.

Floating Point Notation

a) = 11011111b) = 11111011

Page 24: Department of Management School of Business, Economics and Informatics Binary Numbers 2 Eva Szatmari e.szatmari@bbk.ac.uk.

Floating Point Notation

Example 1: Example 2:01011001 10101101

Example 3: Example 4:10101100 11011100

Page 25: Department of Management School of Business, Economics and Informatics Binary Numbers 2 Eva Szatmari e.szatmari@bbk.ac.uk.

Floating Point Notation

a) 10111011b) 10011100

Page 26: Department of Management School of Business, Economics and Informatics Binary Numbers 2 Eva Szatmari e.szatmari@bbk.ac.uk.

Floating Point Notation

a) 10111011 = b) 10011100 =

Page 27: Department of Management School of Business, Economics and Informatics Binary Numbers 2 Eva Szatmari e.szatmari@bbk.ac.uk.

Any Questions?

Page 28: Department of Management School of Business, Economics and Informatics Binary Numbers 2 Eva Szatmari e.szatmari@bbk.ac.uk.

Contact DetailsEva Szatmari

0207 631 6254Or

[email protected] LUCK