Method of Complements - Practical Uses

Practical Uses

The method of complements was used in many mechanical calculators as an alternative to running the gears backwards. For example:

  • Pascal's calculator had two sets of results digits, a black set displaying the normal result and a red set displaying the nines' complement of this. A horizontal slat was used to cover up one of these sets, exposing the other. To subtract, the red digits were exposed and set to 0. Then the subtrahend (the number being subtracted) was dialed in. The slat was then moved to expose the black digits (which now displayed the nines' complement of the subtrahend) and the minuend was added by dialing it in. Finally, the operator had to mentally add 1 and ignore the leftmost 1 to obtain the correct answer.
  • The Comptometer had nines' complement digits printed in smaller type along with the normal digits on each key. To subtract, the operator was expected to mentally subtract 1 from the subtrahend and enter the result using the smaller digits. Since subtracting 1 before complementing is equivalent to adding 1 afterwards, the operator would thus effectively add the ten's complement of the subtrahend. The operator also needed to hold down the "subtraction cutoff tab" corresponding to the leftmost digit of the answer. This tab prevented the carry from being propagated past it, the Comptometer's method of dropping the initial 1 from the result.
  • The Curta calculator used the method of complements for subtraction, and managed to hide this from the user. Numbers were entered using digit input slides along the side of the device. The number on each slide was added to a result counter by a gearing mechanism which engaged cams on a rotating "echelon drum" (a.k.a. "step drum"). The drum was turned by use of a crank on the top of the instrument. The number of cams encountered by each digit as the crank turned was determined by the value of that digit. For example, if a slide is set to its "6" position, a row of 6 cams would be encountered around the drum corresponding to that position. For subtraction, the drum was shifted slightly before it was turned, which moved a different row of cams into position. This alternate row contained the nines' complement of the digits. Thus, the row of 6 cams that had be in position for addition now had a row with 3 cams. The shifted drum also engaged one extra cam which added 1 to the result (as required for the method of complements). The always present tens' complement "overflow 1" which carried out beyond the most significant digit of the results register was, in effect, discarded.

Use of the method of complements is ubiquitous in digital computers, regardless of the representation used for signed numbers. However, the circuitry required depends on the representation:

  • If two's complement representation is used, subtraction requires only inverting the bits of the subtrahend and setting a carry into the rightmost bit.
  • Using ones' complement representation requires inverting the bits of the subtrahend and connecting the carry out of the most significant bit to the carry in of the least significant bit (end-around carry).
  • Using sign-magnitude representation requires only complementing the sign bit of the subtrahend and adding, but the addition/subtraction logic needs to compare the sign bits, complement one of the inputs if they are different, implement an end-around carry, and complement the result if there was no carry from the most significant bit.

The method of complements was used to correct errors when accounting books were written by hand. To remove an entry from a column of numbers, the accountant could add a new entry with the ten's complement of the number to subtract. A bar was added over the digits of this entry to denote its special status. It was then possible to add the whole column of figures.

Complementing the sum is handy for cashiers making change for a purchase from currency in a single denomination of 1 raised to an integer power of the currency's base. For decimal currencies that would be 10, 100, 1,000, etc., e.g. a $10.00 bill.

Read more about this topic:  Method Of Complements

Famous quotes containing the word practical:

    Wisdom is not just knowing fundamental truths, if these are unconnected with the guidance of life or with a perspective on its meaning. If the deep truths physicists describe about the origin and functioning of the universe have little practical import and do not change our picture of the meaning of the universe and our place within it, then knowing them would not count as wisdom.
    Robert Nozick (b. 1938)

    As for Clothing, to come at once to the practical part of the question, perhaps we are led oftener by the love of novelty and a regard for the opinions of men, in procuring it, than by a true utility.
    Henry David Thoreau (1817–1862)