Take the 2-minute tour ×
Computer Science Stack Exchange is a question and answer site for students, researchers and practitioners of computer science. It's 100% free, no registration required.

I'm being asked this question for my computer conceptes class, can't find anything about this in my text book, and have only been able to find half-baked answers googling it.

Why is binary subtraction referred to as the invert-add-shift-add method?

share|improve this question
    
I think it's a silly question (on behalf of your instructor). I'd prefer the name "complement-add". –  Yuval Filmus Feb 4 '13 at 0:44
add comment

1 Answer

up vote 4 down vote accepted

I found an excellent answer here, which I summarize below.

Given two number $A,B$ in binary notation, we calculate $A-B$ by adding to $A$ the two's complement of $B$. Since the two's complement of $B$ is formed by inverting all bits of $B$ and adding $1$, one way to implement this idea is invert $B$, add the result to $A$, shift the carry $1$ bit (which will appear if $A\geq B$), and add it (i.e. $1$) to the result.

share|improve this answer
    
In addition to the above you can watch this video (Two's Complement Part 2 - An Introduction) on YouTube described the procedure clearly and completly! –  Reza Feb 4 '13 at 5:13
add comment

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.