In: Computer Science
Complete the following table. All binary numbers are 8-bit signed integers.
(Don't forget to show the steps of your solution!)
Decimal value |
Sign-magnitude representation |
Ones' complement representation |
Two's complement representation |
-98 |
|||
10001011 |
|||
01110101 |
|||
10100100 |
Compute the results of the indicated operations in columns 2 and 3, assuming that the binary numbers represent integers in the formats given by column 1. Identify which of the operations, if any, results in an overflow. (Don't forget to show the steps of your solution!)
11010010 + 00111101 |
10100000 - 00011101 |
|
Unsigned |
||
Sign-magnitude |
||
Ones' complement |
||
Two's Complement |
I have mentioned where overflow occurs and where overflow does not occur. If you have any doubts in case of 2s compliment just do XOR operation for the most significant bits.You can also implement this for the 1 s compliment also.
You can also do the same and obtain the same result by converting them into the unsigned form and do arithmetic on unsigned representation of numbers.