FOR FREE CONTENT

1’s and 2’s Complement Subtraction   

 

1’s complement subtraction:

Example:

Operation 5 –  using 1’s Complement method.

We can write the above operation as 5 + (-4).

 

Now,

+50101 (in forms of 1’s Complement)

-4 → first write +4 01001011 (1’s Complement)

5 + (-4) = +1

 

 

Note: If we got an around carry then add carry at LSB of the number.

 

2’s complement subtraction:

Example:

Operation 5 – 4 in 2’s Complement form.

 

Solution:

 

In 2’s complement form we discard an around carry.

 

Question:

Perform the operation -5 - 4 by 2’s Complement

 

 

Answer:

-5 in 2’s Complement

-4 in 2’s Complement

 

 

Why we got overflow because -4 and -5 both are in 4 bit carry (-8 to +7) 2’s complement but expected answer -9 is not in range to over add an extra bit at operands.

 

 

 

Question:

Perform the operation 5 + 4 in 2’s Complement.

 

Answer:

We know in decimal 5 + 4 = 9

Now,

 

 

The result is  wrong 1001 why because 0100 positive number and 0101 positive number but the addition of two numbers is a negative number.

1001

So, the actual answer is -7 but the answer should be 9.

 

Even if we perform by 1’s Complement as problem happen to look answer will be same because positive number as 2’s complement and 1’s complement.

 

Answer:

In 1’s complement it is -6 which is wrong; here also answer would be 9.

 

Now why the answer is wrong because it exceeds the range.

Like,

 

 

So, we add 0101 and 0100 which has 4 bit (-7 to 7) but the answer is again in 4 bit (-7 to 7), but it would be 9 which is not possible because 9 not in range.

 

Why we got -7 (2’s Complement) and -6 (1’s Complement) because in 2’s Complement range is (-8 to +7) and 1’s complement range is (-7 to +7).

Now how we can identify the answer is wrong is called overflow.

 

Let x and y symbol indicate the sign of the first digit and second digit respectively. And z is the symbol that indicates the sign of answer, digit.

 

Example:

 

 

 

x y z means when operands, the first number has (-ve) negative sign and the second number have (-ve) negative sign bit but answer or result has positive then overflow occurs.

 

Or,

 

x y z means when a operands, first number has (+ve) positive sign and second number has (+ve) positive sign bit but answer or result has negative then overflow has occurred.

 

Another way carries in and carries out checking.

 

We can say it is overflow or not by checking Cin and Cout, if Cin and Cout are different then overflow will have occurred.

 

Example

 

 

So, here Cin is 1 but Cout is zero (0) then overflow has occurred.

So, overflow will have occurred when Cin and Cout are different.

 

Overcome the problem of overflow:

 

 

Overflow problem occurred because the expected answer (9) exceeds the range.

So, to overcome the problem we can increase the bit of the two operands from 4 bit to 5 bit.

 

5 bit range in 1’s Complement (-15 to +15)

5 bit range in 2’s Complement(-16 to +15)

 

So, accepted result 9 is in the above range.