Binary Subtraction

We do A+(-B) instead of A-B. This simplifies things greatly.

Now we deal with binary addition. We know how to write negative values in binary (Two's Complement). We also know how to add binary values.

Take 37-21. This becomes 37+(-21).

37 in binary is 00100101. 21 in binary is 00010101. Negative 21 in binary is 11101011. Now we add 00100101 and 11101011. Our result is 00010000 (an overflow exists because our proper answer is 9 bits, this is truncated to 8). 00010000 is 16, which happens to be the sum of 37+(-21).

This article was written on 12/09/2023. If you have any thoughts, feel free to send me an email with them. Have a nice day!