ARITHMETIC SUBTRACTION
Arithmetic Subtraction?:
2's complement subtraction:
Subtraction of two signed binary numbers when negative numbers are in 2' s complement form is very simple and can be stated as follows: Take the 2's complement of the subtrahend (including the sign bit) and add it to the minuend (including the sign bit). A carry out of the sign bit position is discarded.
This procedure stems from the fact that a subtraction operation can be changed to an addition operation if the sign of the subtrahend is changed. This is demonstrated by the following relationship:
(±A) - (+B) = (±A) + (-B)
These Topics Are Also In Your Syllabus | ||
---|---|---|
1 | Program Counter | link |
2 | Common Bus System | link |
You May Find Something Very Interesting Here. | link | |
3 | Common Bus System-memory address | link |
4 | Computer Instructions | link |
5 | Instruction Set Completeness | link |
(±A) - (-B) = (±A) + (+B)
But changing a positive number to a negative number is easily done by taking its 2's complement. The reverse is also true because the complement of a negative number in complement form produces the equivalent positive number. Consider the subtraction of (-6) - (- 13) = +7. In binary with eight bits this is written as 11111010 - 11110011. The subtraction is changed to addition by taking the 2's complement of the subtrahend (- 13) to give (+ 13). In binary this is 11111010 + 00001 101 = 10000011 1. Removing the end carry, we obtain the correct answer 00000111 ( + 7).
It is worth noting that binary numbers in the signed-2's complement system are added and subtracted by the same basic addition and subtraction rules as unsigned numbers. Therefore, computers need only one common hardware circuit to handle both types of arithmetic. The user or programmer must interpret the results of such addition or subtraction differently depending on whether it is assumed that the numbers are signed or unsigned.