Вы находитесь на странице: 1из 13

Introduction

Subtraction of a number from another can be accomplished by adding the complement of the subtrahend to the minuend.

1s Complement Subtraction

Subtraction of binary numbers using the 1s complement method allows subtraction only by addition.

Cont.,

The 1s complement of a binary number can be

obtained by changing all 1s to 0s and all 0s and 1s.

1s complement method

To subtract a smaller number from a larger number, the 1s complement method is as follows

1. Determine 2. Add this the tothe the 1s larger complement the smaller number. 3. Remove carry andnumber add it to of the result. This carry is called end-around-carry

Example of 1s complement

Subtract (1010)2 from (1111) 2


Direct Subtraction
1 1 1 1
1 0 1 0 0 1 0 1

1s complement method
1 1 1 1

1s complement Carry Add Carry

0 1 0 1 1 0 1 0 0 1 0 10 1

Subtraction Steps

Subtraction of a large number a smaller one by the 1s complement method involves the following steps

1. The 2. 3. Determine Add answer this to the is the 1s smaller 1s complement complement number of of a large the result number and is opposite in sign. There is no carry.

2s Complement Subtraction

The 2s complement of a binary number can be obtained by adding 1 to its 1s complement.

Steps

Subtraction of a smaller number from a larger one by


the 2s complement method involves the following

steps
1. 2. 3. Determine the 2s complement the smaller Add this Omit theto carry larger ( there number is alwaysof a carry in thisnumber case )

Example of 2s complement

Subtract (1010)2 from (1111) 2


Direct Subtraction
1 1 1 1 1 0 1 0 0 1 0 1

2s complement method
1 1 1 1

2s complement Carry

0 1 1 0 1 0 1 0 1

Subtraction Steps

The carry is discarded. Thus answer is (0101)2 The 2s complement method for subtraction of a large number from a smaller one is as follows.

1. To 2. 3. Determine Add There the is 2s no the carry complement 2s. complement The result to the is smaller in of the 2s the complement larger number form 4. get an answer in true form, take 2s number is negative and change the sign. complement

Comparison between 1s and 2s complements


1s Complement

2s Complement

It can be easily obtained using an Inverter It requires two operations

It has to be arrived at by first obtaining the 1s complement and then adding one (1) to it Only one arithmetic operation is required It is used only for arithmetic applications

It is often used in logical manipulations for inversion operation

The End

.. Thank You

Вам также может понравиться