Question #3
Before the two’s-complement representation of signed binary numbers was invented, some computers used sign-and-magnitude representation. In this representation, the most significant bit is only the sign of the number (0 for positive, 1 for negative); it has no place value. The remaining bits are interpreted as an unsigned number. For instance, the four-bit number 1011 in sign-and-magnitude represents -3, and 0101 represents 5.
a. If you add the four-bit sign-and-magnitude numbers 0100 and 0101 using unsigned addition, what is the value of the result, interpreted as sign-and-magnitude?
b. If you add the four-bit sign-and-magnitude numbers 0010 and 1001 using unsigned addition, what is the value of the result, interpreted as sign-and-magnitude?
c. If you add the four-bit sign-and-magnitude numbers 1010 and 1001 using unsigned addition, what is the value of the result, interpreted as sign-and-magnitude?
d. Describe an algorithm for adding sign-and-magnitude numbers which will make sums involving negative numbers come out correctly. For instance 0010 + 1001 should produce 0001 (1), and 1010 + 1001 should produce 1011 (-3). Don’t worry about what happens on overflow in either direction.