Subtraction
Consider if we have to find the subtraction x-y, we perform the following steps:
- Take 2’s complement of y
- Add x and 2’s complement of y
for eg:
x=3, y=2 for 4 bits 2's complement representation 3---> 0011 Take 2's complement of 2----> 0010 1101 + 1 ---> 1110 Adding 0011 and 1110 0011 1110 0001 ---> +1 (discard carry 1 from MSB)
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.