Two's-Complement Arithmetic
- In order to add signed numbers, simply perform the standard addition. If the numbers are correctly signed, the answer will come out with the correct sign.
- In order to subtract signed numbers, take the two's-complement of the number being subtracted and add the two numbers.
- When adding and subtracting be sure the answer does not exceed the range of the signed numbers.
(+127 to –128 for 8-bit numbers; +32,767 to –32,768 for 16-bit numbers)