COMPUTER SCIENCE Data Representation and Machine Concepts Section 1.5 Instructor: Lin Chen Sept...

17
COMPUTER SCIENCE Data Representation and Machine Concepts Section 1.5 Instructor: Lin Chen Sept 2013

description

Binary Notation 1 Data Storage Recall How to convert binary notation to decimal notation How to convert decimal notation to binary notation Convert to decimal notation Convert to binary notation

Transcript of COMPUTER SCIENCE Data Representation and Machine Concepts Section 1.5 Instructor: Lin Chen Sept...

Page 1: COMPUTER SCIENCE Data Representation and Machine Concepts Section 1.5 Instructor: Lin Chen Sept 2013.

COMPUTER SCIENCEData Representation and Machine ConceptsSection 1.5

Instructor: Lin ChenSept 2013

Page 2: COMPUTER SCIENCE Data Representation and Machine Concepts Section 1.5 Instructor: Lin Chen Sept 2013.

1.5 The Binary System

1 Data Storage

Binary Notation

Binary Addition

Fractions in Binary

Pearson Custom: Computer Science, Data Representation and Machine Concepts

Page 3: COMPUTER SCIENCE Data Representation and Machine Concepts Section 1.5 Instructor: Lin Chen Sept 2013.

Binary Notation

1 Data Storage

RecallHow to convert binary notation to decimal notationHow to convert decimal notation to binary notation

Convert 11010012 to decimal notation

Convert 12310 to binary notation

Page 4: COMPUTER SCIENCE Data Representation and Machine Concepts Section 1.5 Instructor: Lin Chen Sept 2013.

Binary Addition

1 Data Storage

Binary addition rule

0 + 0 = 01 + 0 = 10 + 1 = 11 + 1 = 101 + 1 + 1 = 11

10010011+ 111011

Page 5: COMPUTER SCIENCE Data Representation and Machine Concepts Section 1.5 Instructor: Lin Chen Sept 2013.

Binary Addition

1 Data Storage

Binary addition rule

0 + 0 = 01 + 0 = 10 + 1 = 11 + 1 = 101 + 1 + 1 = 11

10010011+ 111011

0

1

Page 6: COMPUTER SCIENCE Data Representation and Machine Concepts Section 1.5 Instructor: Lin Chen Sept 2013.

Binary Addition

1 Data Storage

Binary addition rule

0 + 0 = 01 + 0 = 10 + 1 = 11 + 1 = 101 + 1 + 1 = 11

10010011+ 111011

10

11

Page 7: COMPUTER SCIENCE Data Representation and Machine Concepts Section 1.5 Instructor: Lin Chen Sept 2013.

Binary Addition

1 Data Storage

Binary addition rule

0 + 0 = 01 + 0 = 10 + 1 = 11 + 1 = 101 + 1 + 1 = 11

10010011+ 111011

110

11

Page 8: COMPUTER SCIENCE Data Representation and Machine Concepts Section 1.5 Instructor: Lin Chen Sept 2013.

Binary Addition

1 Data Storage

Binary addition rule

0 + 0 = 01 + 0 = 10 + 1 = 11 + 1 = 101 + 1 + 1 = 11

10010011+ 111011

1110

11

Page 9: COMPUTER SCIENCE Data Representation and Machine Concepts Section 1.5 Instructor: Lin Chen Sept 2013.

Binary Addition

1 Data Storage

Binary addition rule

0 + 0 = 01 + 0 = 10 + 1 = 11 + 1 = 101 + 1 + 1 = 11

10010011+ 111011

01110

111

Page 10: COMPUTER SCIENCE Data Representation and Machine Concepts Section 1.5 Instructor: Lin Chen Sept 2013.

Binary Addition

1 Data Storage

Binary addition rule

0 + 0 = 01 + 0 = 10 + 1 = 11 + 1 = 101 + 1 + 1 = 11

10010011+ 111011

001110

1111

Page 11: COMPUTER SCIENCE Data Representation and Machine Concepts Section 1.5 Instructor: Lin Chen Sept 2013.

Binary Addition

1 Data Storage

Binary addition rule

0 + 0 = 01 + 0 = 10 + 1 = 11 + 1 = 101 + 1 + 1 = 11

10010011+ 111011

1001110

1111

Page 12: COMPUTER SCIENCE Data Representation and Machine Concepts Section 1.5 Instructor: Lin Chen Sept 2013.

Binary Addition

1 Data Storage

Binary addition rule

0 + 0 = 01 + 0 = 10 + 1 = 11 + 1 = 101 + 1 + 1 = 11

10010011+ 111011

11001110

1111

Page 13: COMPUTER SCIENCE Data Representation and Machine Concepts Section 1.5 Instructor: Lin Chen Sept 2013.

Binary Addition

1 Data Storage

1001001+ 0011001

1000111+ 0010110

Questions:

http://www.atilim.edu.tr/~compe111/

Page 14: COMPUTER SCIENCE Data Representation and Machine Concepts Section 1.5 Instructor: Lin Chen Sept 2013.

Fractions in Binary

1 Data Storage

Convert fractional binary number to decimal number

1 0 . 0 1 1 = 1* 21 + 0*20 + 0*2-1 + 1*2-2 + 1*2-3

= 2 + 0 + 0 + + = 2.375

1 0 -1 -2 -3

Questions:Convert following two base notations to their equivalent ten base notation

100.110 111.001 0.101

Page 15: COMPUTER SCIENCE Data Representation and Machine Concepts Section 1.5 Instructor: Lin Chen Sept 2013.

Fractions in Binary

1 Data Storage

Convert fractional decimal number to binary number

2.375

Integer Part Fractional Part

210 = 102 0.375 * 2 = 0.75 0

0.75 * 2 = 1.5 1

0.5 * 2 = 1.0 1

10.011

Page 16: COMPUTER SCIENCE Data Representation and Machine Concepts Section 1.5 Instructor: Lin Chen Sept 2013.

Fractions in Binary

1 Data Storage

Questions:Convert following fractional decimal number to binary number

4.5 1.125 10.1

Page 17: COMPUTER SCIENCE Data Representation and Machine Concepts Section 1.5 Instructor: Lin Chen Sept 2013.

Fractions in Binary

1 Data Storage

Addition

10.011+ 100.110

1. Align radix point2. Do addition with the binary addition rule