**3.2.3 ONE’S COMPLEMENT ADDITION AND SUBTRACTION**Although it is not heavily used in mainstream computing anymore, the one’s complement representation was used in early computers.

One’s complement addition is handled somewhat differently from two’s complement addition: the carry out of the leftmost position is not discarded, but is added back into the least signiﬁcant position of the integer portion as shown in Figure 3-7.

This is known as an

One’s complement addition is handled somewhat differently from two’s complement addition: the carry out of the leftmost position is not discarded, but is added back into the least signiﬁcant position of the integer portion as shown in Figure 3-7.

This is known as an

**end-around carry**We can better visualize the reason that the end-around carry is needed by examining the 3-bit one’s complement number circle in Figure 3-8.

Notice that the number circle has two positions for 0. When we add two numbers, if we traverse through both −0 and +0, then we must compensate for the fact that 0 is visited twice. The end-around carry advances the result by one position for this situation.

Notice that the distance between −0 and +0 on the number circle is the distance between two integers, and is not the distance between two successive representable numbers. As an illustration of this point, consider adding (5.5)10 and (−1.0)10 in one’s complement arithmetic, which is shown in Figure 3-9. (Note that we can also treat this as a subtraction problem, in which the subtrahend is negated by complementing all of the bits, before adding it to the minuend.)

In order to add (+5.5)10 and (−1.0)10 and obtain the correct result in one’s complement, we add the end-around carry into the one’s position as shown. This adds complexity to our number circle, because in the gap between +0 and −0, there are valid numbers that represent fractions that are less than 0, yet they appear on the number circle before −0 appears. If the number circle is reordered to avoid this anomaly, then addition must be handled in a more complex manner. The need to look for two different representations for zero, and the potential need to perform another addition for the end-around carry are two important reasons for preferring the two’s complement arithmetic to one’s complement arithmetic.

## No comments:

## Post a Comment