196k views
5 votes
Assume 185 and 122 are signed 8-bit decimal integers stored in sign-magnitude format. Calculate 185 + 122. Is there overflow, underflow, or neither?

1 Answer

2 votes

Final answer:

In sign-magnitude format, the sum of 185 and 122 in binary form is 100100011, which causes an overflow.

Step-by-step explanation:

In sign-magnitude format, the most significant bit represents the sign. In an 8-bit signed integer, the leftmost bit is the sign bit. If the sign bit is 0, the number is positive, and if it is 1, the number is negative.

185 is represented as 10111001 in sign-magnitude format, and 122 is represented as 01111010.

To calculate the sum, we will add the two numbers as if they were unsigned integers. 10111001 + 01111010 = 100100011.

The resulting binary number is 9 bits long, which exceeds the 8-bit length of the original numbers. Therefore, there is an overflow in this addition.

User Matt Wiebe
by
7.9k points