Binary overflow

1k Views Asked by At

Which of the following hexadecimal numbers, representing signed 16-bit binary numbers, results in overflow when multiplied by 4? Here, a negative number is represented in 2's complement.

a. 1FFF    b. DFFF,    c.E000, d.FFFF

Does this mean that I have to convert all the values from a to d to binary, then represent them in 2's complement, then multiply them by 4? For example :

1FFF = 0001 1111 1111 1111 (binary) 
= 1110 0000 0000 0001 (2's complement)  
2's complement * 4 = 11 1000 0000 0000 0100 

But I think I misunderstood the question, because the results after multiplying by 4 for all values exceed 16-bit binary, mean they all get over flow after the multiplication

Please clarify if there is any blunders I'm having. Thanks!

1

There are 1 best solutions below

5
On

You are expected to take those numbers to be already in 2's complement notation. $1FFF$ is the same in binary and 2's complement, because it is positive. If the MSB is set in 2's complement, the number is negative, otherwise it is positive. The point is that one neat thing about 2's complement is you don't worry about the sign, you just multiply. So $1FFF \cdot 0004=7FFC$, which doesn't overflow. The hard part is when multiplying by a negative will overflow.