Academic Integrity: tutoring, explanations, and feedback — we don’t complete graded work or submit on a student’s behalf.

Perform the following arithmetic operations in binary using 8-bit 2\'s complemen

ID: 3848439 • Letter: P

Question

Perform the following arithmetic operations in binary using 8-bit 2's complement representation. Perform subtraction by finding the 2's complement of the subtrahend and then performing addition. Give an appropriate indicator of overflow, if it occurs. Make sure that you identify the specific sign in your arithmetic that indicates overflow. I did not choose the numbers in this problem by accident; where appropriate, you need not repeat your work to represent the values you use in solving this problem. a. (+39) + (+76) b. (-106) + (+39) c. (-47) + (+111) d. (+111) - (+76) e. (+39) + (+111) f. (-82)-(+76)

Explanation / Answer

An overflow happens in 2 cases:

1. Sum of 2 positive numbers is a negative number, that is if 8th bit of first and second binaries are 0 but the 8th bit of the resultant binary is 1

2. Sum of 2 negative numbers is a positive number, that is if 8th bit of first and second binaries are 1 but the 8th bit of the resultant binary is 0

If one of the numbers is positive and the other is negative, overflow cannot happen

(a)

binary representation of 39: 100111

binary representation of 76: 1001100

2's complement representation of +39: 00100111

2's complement representation of +76: 01001100

(+39) + (+76):

0 0 0 1 1 0 0 0 <-- carry

0 0 1 0 0 1 1 1

0 1 0 0 1 1 0 0 +

--------------------------

0 1 1 1 0 0 1 1

----------------------------

Sign bit (8th bit) is 0. Hence no overflow.

Hence the result is positive with value: 1110011, which is 115.

(b)

binary representation of 106: 1101010

binary representation of 39: 100111

2's complement representation of -106: 1(1's complement of 106) + 1 = 10010101 + 1 = 10010110

2's complement representation of +39: 00100111

(-106) + (+39):

0 0 0 0 1 1 0 0 <-- carry

1 0 0 1 0 1 1 0

0 0 1 0 0 1 1 1 +

--------------------------

1 0 1 1 1 1 0 1

----------------------------

Overflow cannot happen.

The sign bit here is 1,

Hence the result is negative with value: 1's complement of (0111101) = 1000010 +1 = 1000011 , which is -67.

(c)

binary representation of 47: 101111

binary representation of 111: 1101111

2's complement representation of -47: 1(1's complement of 47) + 1 = 11010000 + 1 = 11010001

2's complement representation of +111: 01101111

(-47) + (+111):

1 1 1 1 1 1 1 0 <-- carry

1 1 0 1 0 0 0 1

0 1 1 0 1 1 1 1 +

--------------------------

0 1 0 0 0 0 0 0

----------------------------

Overflow cannot happen.

The sign bit here is 0,

Hence the result is positive with value:  1 0 0 0 0 0 0 , which is 64.

(d)

binary representation of 111: 1101111

binary representation of 76: 1001100

2's complement representation of +111: 01101111

2's complement representation of -76: 1(1's complement of 76) + 1= 10110011 + 1 = 10110100

(+111) - (+76) = (+111) + (-76)

1 1 1 1 1 0 0 0 <-- carry

0 1 1 0 1 1 1 1

1 0 1 1 0 1 0 0 +

--------------------------

0 0 1 0 0 0 1 1

----------------------------

Overflow cannot happen.

The sign bit here is 0,

Hence the result is positive with value: 1 0 0 0 1 1 which is 35.

(c)

binary representation of 47: 101111

binary representation of 111: 1101111

2's complement representation of -47: 1(1's complement of 47) + 1 = 11010000 + 1 = 11010001

2's complement representation of +111: 01101111

(-47) + (+111):

1 1 1 1 1 1 1 0 <-- carry

1 1 0 1 0 0 0 1

0 1 1 0 1 1 1 1 +

--------------------------

0 1 0 0 0 0 0 0

----------------------------

Overflow cannot happen.

The sign bit here is 0,

Hence the result is positive with value:  1 0 0 0 0 0 0 , which is 64.

(e)

binary representation of 39: 100111

binary representation of 111: 1101111

2's complement representation of +39: 00100111

2's complement representation of +111: 01101111

(+39) + (+111):

1 1 0 1 1 1 1 0 <-- carry

0 0 1 0 0 1 1 1

0 1 1 0 1 1 1 1 +

--------------------------

1 0 0 1 0 1 1 0

----------------------------

The sign bit of the addends is 0 where as result is 1, hence its an overflow.

(f)

binary representation of 82: 1010010

binary representation of 76: 1001100

2's complement representation of -82: 1(1's complement of 82) + 1= 10101101 + 1 = 10101110

2's complement representation of -76: 1(1's complement of 76) + 1= 10110011 + 1 = 10110100

(-82) - (+76) = (-82) + (-76)

0 1 1 1 1 0 0 0 <-- carry

1 0 1 0 1 1 1 0

1 0 1 1 0 1 0 0 +

--------------------------

0 1 1 0 0 0 1 0

----------------------------

The sign bit of the addends is 1 where as result is 0, hence its an overflow.

Hire Me For All Your Tutoring Needs
Integrity-first tutoring: clear explanations, guidance, and feedback.
Drop an Email at
drjack9650@gmail.com
Chat Now And Get Quote