Note: Subtraction is simply the addition of a negative number and a positive number.
Definitions:
| 5= | Minuend |
| -3= | Subtrahend |
| 2= | Difference |
Algorithm for Binary Subtraction
- Perform a logical NOT on the subtrahend to produce the ones compliment of the subtrahend.
- Add 1 to the ones compliment of the subtrahend to produce the twos compliment of the subtrahend.
- Add the twos compliment of the subtrahend to the minuend.
- The result is difference of the minuend - subtrahend.
In essence by taking the subtrahend of the equation and turning it into its twos compliment,
you are effectively turning it into a negative binary number. And as I said at the beginning
you can think of subtraction as the addition of a negative number and a positive number.