# 2's complement additions(is my working correct)

• Aug 5th 2010, 09:34 AM
anderson
2's complement additions(is my working correct)
Hi everyone

Need help to verify my working,especially for Qiii, the extra 9th bit is not present.

Perform the arithmetic using 2’s complement notation. The numbers are given in decimal, so first convert them to appropriate form. Make suitable assumptions.
(i) -29 – 37
-29 =00011101
nvert = 11100010+1
= 11100011

-37 =00100101
invert = 11011010+1
= 11011011

11100011+11011011=110111110
=-66

(ii) 95 – 28
95=01011111
-28=00011100
INVERT=11100011+1=11100100
01011111+11100100=01000011
=67

(iii) 28 – 78
28=00011100
-78=01001110=10110001+1=10110010
00011100+10110010=11001110
-50

Thank you for all your kind help & support.
• Aug 5th 2010, 10:12 AM
Hello anderson
Quote:

Originally Posted by anderson
Hi everyone

Need help to verify my working,especially for Qiii, the extra 9th bit is not present.

Perform the arithmetic using 2’s complement notation. The numbers are given in decimal, so first convert them to appropriate form. Make suitable assumptions.
(i) -29 – 37
-29 =00011101
nvert = 11100010+1
= 11100011

-37 =00100101
invert = 11011010+1
= 11011011

11100011+11011011=110111110
=-66

(ii) 95 – 28
95=01011111
-28=00011100
INVERT=11100011+1=11100100
01011111+11100100=01000011
=67

(iii) 28 – 78
28=00011100
-78=01001110=10110001+1=10110010
00011100+10110010=11001110
-50

Thank you for all your kind help & support.

The assumption we need to make is that this is 8-bit 2's complement. So the valid range of integers is -128 to +127 (decimal).

Provided we don't overflow this range, we can work to 8 bits and ignore any 9th bit that may arise.

So in (i) when you add the 2's complement numbers you get:
...11100011 +
...11011011
...---------
(1)10111110
Ignoring the overflow 9th bit (1), converting the remaining 8 bits back to decimal gives the answer -66.

This situation with the overflow bit doesn't arise in (ii) and (iii), so there's no problem with your working.

• Aug 5th 2010, 10:13 AM
Quote:

Originally Posted by anderson
Hi everyone

Need help to verify my working,especially for Qiii, the extra 9th bit is not present.

Perform the arithmetic using 2’s complement notation. The numbers are given in decimal, so first convert them to appropriate form. Make suitable assumptions.
(i) -29 – 37
29 =00011101
invert all bits and add 1..... 11100010+1
-29= 11100011 in 2's complement form

37 =00100101
-37 = 11011011 in 2's complement form

11100011+11011011=110111110
=-66

(ii) 95 – 28
95=01011111
28=00011100
INVERT and add 1....=11100011+1=11100100=-28 in 2's complement form
01011111+11100100=01000011
=67

(iii) 28 – 78
28=00011100
78=01001110 which is 10110001+1=10110010 in 2's complement form
00011100+10110010=11001110
-50

Thank you for all your kind help & support.