0% found this document useful (0 votes)
421 views

CMP 101 Set 5 Computer Arithmetic

1. Computer arithmetic involves performing basic mathematical operations like addition, subtraction, multiplication, and division using binary numbers instead of decimal numbers. Everything that can be done using decimal numbers can also be done using binary numbers. 2. Binary addition and subtraction are performed in a similar way as decimal addition and subtraction, with carrying or borrowing from one column to the next. Multiplication in binary involves shifting the multiplicand left by one position for each digit in the multiplier and adding the partial products. Division in binary uses a "divide and subtract" approach to iteratively calculate the quotient and remainder. 3. There are also alternative subtraction methods like complementary subtraction that involve taking the complement of the subtrahend before adding it to the

Uploaded by

Nitin Grover
Copyright
© Attribution Non-Commercial (BY-NC)
Available Formats
Download as PPT, PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
421 views

CMP 101 Set 5 Computer Arithmetic

1. Computer arithmetic involves performing basic mathematical operations like addition, subtraction, multiplication, and division using binary numbers instead of decimal numbers. Everything that can be done using decimal numbers can also be done using binary numbers. 2. Binary addition and subtraction are performed in a similar way as decimal addition and subtraction, with carrying or borrowing from one column to the next. Multiplication in binary involves shifting the multiplicand left by one position for each digit in the multiplier and adding the partial products. Division in binary uses a "divide and subtract" approach to iteratively calculate the quotient and remainder. 3. There are also alternative subtraction methods like complementary subtraction that involve taking the complement of the subtrahend before adding it to the

Uploaded by

Nitin Grover
Copyright
© Attribution Non-Commercial (BY-NC)
Available Formats
Download as PPT, PDF, TXT or read online on Scribd
You are on page 1/ 16

COMPUTER ARITHMETICS

Fundamentals of Computer and programming in C (CMP 101 )

Computer Arithmetic
Every thing that can be done in decimal number system can also be done in binary number system

Binary Arithmetic
13-04-2012

Addition
0 0 1 1
Like in Decimal System
13-04-2012

+ + + +

0 1 0 1 9

= = = =

0 1 1 0 +

A carry of 1 to the next higher column

Examples 1 0 1 1 0 1 1 1
5 2

1 0 0 1 1 1 0 0 1
1
13-04-2012

1 0

Examples
1 1 1 1 1

1 0 0 1 1 1 1 1 0 1 1
1 0 0 0 0 1 0

13-04-2012

0 0 1 1

0 1 0 1

Subtraction = 0 A borrow from = 1 the left column = 1 10 = 0 4 16 5 6 - 2 9 - 2 9 2 7

13-04-2012

Subtraction
1 2

2 0 1

0 1

13-04-2012

0
0

0 1
0

1
1

0 1
1

1 0
1

Complementary Subtraction
Complement = (basen -1) m
Where:

is the number. n denotes number of digits in m


Complement of 3710 = 102 -1-37=99-37 = 6210
13-04-2012

Complementary Method
Find complement of subtrahend
Add the minuend If there is carry of 1, add it.
If no carry, then re-complement the result and negate the number.
13-04-2012

Complementary Method
Subtract 5610 (subtrahend) from 9210 (minuend)

99-56 + 92 =135, 35+1 =36

There is a carry so add it

Subtract 3510 (subtrahend) from 1810 (minuend)

99-35 + 18 =82 99-82 =


13-04-2012

-17

There is no carry so recomplement and negate the result

Complementary Method
Subtract 0111000 from 10111000

0 1 + 1 1 0

0 0 Subtrahend 1 1 Complement 0 0 Minuend 1 1 Carry ?Yes 1 Add it 0 1 0 0 1 0 0 Result

1 0 0 1

1 0 1 0

1 0 1 0

0 1 1 0

13-04-2012

Complementary Method
Subtract 100011 from 010010

1 0 0 1 - 0
13-04-2012

0 1 1 0 1

0 1 0 1 0

0 1 0 1 0

1 0 1 1 0

1 0 0 0 1

Subtrahend Complement Minuend Carry ?No


Re-complement

Place a Negative Sign

Multiplications
0 0 1 1 0 1 0 1 0 0 0 1 Multiplier Multiplicand

0 0 0 1 0 1 1 0 1

1 1 1 0 0 0 1

0 0 0 0 0

1 0 0 1 1 0 0

1 0 1 0 1 0 0 1

1 0 1 0 1 0 1 0 S S
1 0 1 1 0 1 0

0 1 0

For each 0 shift left

13-04-2012

Multiplications
1 x 1 1 1 1
1

Carry

1
1

1 1 0
1

1 1 1 1 1 0
1

1 1 1 1
0
1

1 1 1

13-04-2012

Division
Quotient 0 1 0 1

Divisor 1 1 0

1 0 0 0 0 1 1 0 1 0 0 0 1 1 0 1 0 0 1 1 0 1 0 0

Dividend

Result

0101.11
1 1

Subtraction not possible quotient 0


Subtraction possible quotient 1

1 1 0 1

Remainder

13-04-2012

13-04-2012

You might also like