Multiplication
If operands x and y which need to be multiplied are of n and m digits respectively then the result will be n+m digits. To get correct results we extend digits of both operands to n+m digits
For eg: x=13, y=-6
13 requires 5(m) bits for representation. and -6 requires 4 bits(n) so we will make the bits of 13 and -6 to be equal to m+n = 5+4 = 9
13 ------> 000001101 -6 ------> 111111010 (2's complement of 6)
We then take 2’s complement of 110110010 which is 001001110 which is 78. And so 110110010 is -78.
Conclusion:
In this article, we have seen addition, subtraction, and multiplication in 2’s complement representation of signed integers. If you want to read more about different types of representations of signed integers and why 2’s complement is the best among all do read this article Different ways to represent Signed Integers.
Arithmetic Operations of 2’s Complement Number System
We all know how to perform arithmetic operations of binary number systems. However, computer system generally stores numbers in 2’s complement format. So it becomes necessary for us to know how arithmetic operations are done in 2’s complement.