Stupid question that's been annoying me

From: Jeffrey S. Sharp <jss_at_subatomix.com>
Date: Sun Sep 30 12:06:26 2001

On Sun, 30 Sep 2001, Pete Turnbull wrote:

> you're assuming (on the left) that "carry" is the same as "borrow".
> Wrong! If you are subtracting, working the columns right-to-left, a
> borrow from one column to the previous (on the right) is balanced by
> adding the borrowed digit back to the subtrahend, so it gets
> subtracted from the result, not added. This is the opposite of a
> carry.

This works itself out exactly like that below.

> However, you'll get the right answer if you say that "A - B" is the
> same as "A + inv(B) + 1" where "inv(B)" is the ones-complement of B.

Bingo! That fixed it:

* I get correct overflow flag values.

* The correct borrow flag value is the opposite of the carry out of the
  addition.

Now what's disturbing is that the same wrong ideas that I was taught were
taught to an entire roomful of college students a few years ago, by a
professor in the School of Electrical and Computer Engineering.

Thanks for the help.

--
Jeffrey S. Sharp
jss_at_subatomix.com
Received on Sun Sep 30 2001 - 12:06:26 BST

This archive was generated by hypermail 2.3.0 : Fri Oct 10 2014 - 23:34:26 BST