mathematics with binary. question below is a binary string which is the least significant bit...

6
Mathematics with Binary

Upload: avice-oliver

Post on 22-Dec-2015

219 views

Category:

Documents


2 download

TRANSCRIPT

Page 1: Mathematics with Binary. Question  Below is a binary string  Which is the least significant bit (LSB)?  Which is the most significant bit (MSB)? 0

Mathematics with Binary

Page 2: Mathematics with Binary. Question  Below is a binary string  Which is the least significant bit (LSB)?  Which is the most significant bit (MSB)? 0

QuestionBelow is a binary string

Which is the least significant bit (LSB)? Which is the most significant bit (MSB)?

0 0 0 1 0 1 1 1

MSB LSB

Page 3: Mathematics with Binary. Question  Below is a binary string  Which is the least significant bit (LSB)?  Which is the most significant bit (MSB)? 0

ObjectivesAdd two binary numbers and multiply two

binary numbers.

Convert a denary integer into Two's Complement and vice versa.

Describe the use of Two's Complement to perform subtraction.

Page 4: Mathematics with Binary. Question  Below is a binary string  Which is the least significant bit (LSB)?  Which is the most significant bit (MSB)? 0

Binary AdditionYou have to be able to add together two

binary numbers, and it’s easy!

Lets try to add together 00011001 00011010

Rules for Maths in Binary

0 + 0 = 0

0 + 1 = 1

1 + 0 = 1

1 + 1 = 10 (carry 1)

1 + 1 + 1 = 11(1 and carry 1)

0001100100011010

110011

1100

Page 5: Mathematics with Binary. Question  Below is a binary string  Which is the least significant bit (LSB)?  Which is the most significant bit (MSB)? 0

Binary Subtraction Subtraction has an extra step as we have to use two’s

complement, to make the number that we are taking way into a negative

Two’s Complement is used to convert a number to a negative

Lets look at taking away the following: 00010001 (17) 00001101 (13 – Decimal)

Step 1 – Convert 13 to twos complement

11110011Step 2 – We now add together the two numbers

1111001100010001

00100000

111111

Rules for Maths in Binary

0 + 0 = 0

0 + 1 = 1

1 + 0 = 1

1 + 1 = 10 (carry 1)

1 + 1 + 1 = 11(1 and carry 1)

Page 6: Mathematics with Binary. Question  Below is a binary string  Which is the least significant bit (LSB)?  Which is the most significant bit (MSB)? 0

Binary Multiplication This can be slightly longer but follows the same rules as

doing multiplication in denary.

Lets look at multiplying the following numbers: 10110 00101

1011000101 Rules for

Multiplication

0 x 0 = 0

0 x 1 = 0

1 x 0 = 0

1 x 1 = 1

10110

10110. . . . .

. . . . .. . . . .

1101110

1