[Math] Binary subtraction with borrowing vs. 2’s complement

arithmeticbinarycomputer science

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?

Best Answer

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.

Related Question