Methodcomplements
In mathematics,methodcomplements istechnique usedsubtract one number from another using only additionpositive numbers. Specifically,numberbe subtractedfirst converted into its complement,then added toother number.One practical application ofmethodcomplements isperforming subtraction incomputer microprocessor which usesbinary numeral system. Binary computers typically employtwo's complement foroperationsubtraction.
Indecimal numbering system,methodcomplements can be carried out using nine's complement or ten's complement.
| Tablecontents |
|
2 Ten's complement 3 Comments |
Nine's complement
To subtractnumber y (the subtrahend) from another number x (the minuend), nine's complement may be used. In this method, ycomplemented by determiningcomplementeach digit. The complement ofdecimal digit innine's complement system isnumber that must be addeditproduce 9. The complement36,complement72,so on. Givensubtraction problem:
873 (x) - 218 (y)The nine's complementy (218)781. This issame as subtracting y from 999. The number9'sequal tonumberdigits as y itself has.
Next,complementyaddedx:
873 (x) + 781 (complementy) = 1654The first "1" digitthen dropped, giving 654. Finally, 1added toresult, giving 655. It can easily be verified that 873 - 218 = 655.
This technique works differently if x < y. In that case, there will not be"1" digitcross out atend,nor is"1" added toresult. For example:
185 (x) - 329 (y)Complementing y gives:
185 (x) + 670 (y) = 855The result855then complemented, giving 144. Since x < y,negative sign must be added, soanswer-144. Again,can easily be confirmed that 185 - 329 = -144.
Ten's complement
Withten's complement approach,complement ofsubtrahendfoundregard10n, where n isnumberdigitsy. Usingsame example as above:
873 (x) - 218 (y)The complementyrespect103 = 1000 issame as 1000 - y, or 782. Insame way as before, this numberaddedx:
873 (x) + 782 (complementy) = 1655Droppinginitial "1" gives 655. Since ten's complement was used, thereno needadd 1 toresult.
For cases where x <= y,second approach must be used. Note thatten's complement, if x = y, this approach must be used also. Usingsame example as before:
185 (x) - 329 (y)Complementing y using ten's complement gives:
185 (x) + 671 (y) = 856Finally, complementing 856ten's complement givesresult 144, or -144 oncenegative signadded.
Comments
The necessityerasinginitial "1" inresultconvenient, particularly considering that computer microprocessors typically havelimited, fixed numberdigitswhichperform arithmetic. Inmicroprocessor that can only contain 8 bits,example,leftmost "1" inexamples aboveequivalent toninth bit, whichlost during calculation. Since subtraction may becomplex operation involving multiple steps formicroprocessor,methodcomplementsextremely usefulperforming subtractions using only addition. For details, see two's complement.
