# Binary subtraction with borrowing vs. 2's complement

Consider the following two binary numbers which are using sign-magnitude representation. Therefore, both are positive numbers.

A = 0001 1001 0001
B = 0000 1101 1100


For subtraction, if you use the borrowing method, the result if 0000 1011 0101 which is also a positive number and there is no overflow for that. Note that the carry bit is 0.

Now, if we want to calculate A-B using A+(-B) which means A plus the 2'complement of B, the same number is obtained. However, the carry bit will be 1.

2'B = 1111 0010 0100


So, 0001 1001 0001 + 1111 0010 0100 equals 0000 1011 0101, but this time the carry bit is 1.

What does that mean and how we should interpret that?

## 2 Answers

I think it's clear that in the borrowing method, the carry bit always be zero. On the other hand, the two's complement of B is always just

1 0000 0000 0000 - B.

So the carry bit will be 1.

In two's complement overflow is understood differently. It will only occur when the sum of two positive numbers is negative or the sum of two negative numbers is positive, regardless of the carry bit. (actually, when two positive numbers are added and result in a negative number, the carry is 0 yet it is still considered to be an overflow). So in your example since we are adding a positive and a negative number together, it is not an overflow.