## Re: Two's Complement

Subject: Re: Two's Complement
From: Dave Whelan <dwhelan -at- PANGEA -dot- CA>
Date: Thu, 30 Jul 1998 18:42:30 -0500

Becky asks for opinions on whether to use an apostrophe for twos (two's)
complement. She says:

>My McGraw-Hill Dictionary and my MS Press Computer Dictionary
>both say "yes" to the apostrophe. It is logical, yet our company
>word list has had this word on it as twos complement with NO apostrophe
>for YEARS. We are discussing it now and I wanted to get some other
>viewpoints.

Linda asks how the phrase is used.

I have seen it written both ways but I prefer the no-apostrophe option. I
think it depends on whether you see the word two as a possessive noun or as
an adjective differentiating this type of complement from other types of
complement. I disagree with your opinion that it is logical to apostrophize
the word two because I don't think it's a possessive noun.

Complementing numbers enables us to use an alternative method of arithmetic
subtraction. Subtraction by complementing does not depend on the numbering
system used. The complement of the number is the result of subtracting the
number from the highest single digit in the numbering system.

In the decimal system, the highest single digit is 9, so the complement in
the decimal numbering system is called the nines complement. To find the
nines complement of a number, subtract each of the digits in the number from
a series of nines: the nines complement of 123, for instance, is 876
(999-123 = 876). (Note that you don't subtract from only one nine, but from
as many nines as there are digits, so even if the word nines in nines
complement was a possessive noun, the proper term would be nines', not
nine's, complement.)

Suppose you wished to subtract 123 from 456 using subtraction by
complementing, you would first work out the nines complement of 123, (876)
then add it to 456 (876 + 456 = 1332). Note that we now have a fourth,
overflow, digit in the partial result: we remove this leftmost digit (1) and
treat it as an end-around carry to be added to the remaining partial result.
This gives us 332 + 1 = 333 as our final result.

Subtraction by complementing works for any number in any numbering system.
It just so happens that it works extremely well in the binary numbering
system used by computers. In the binary system, the highest single digit is
1, so we use the ones complement. To find the ones complement of a binary
number, subtract each of the digits in the number from a series of ones. As
we are dealing with the binary numbering system this simply means converting
ones to zeros and vice versa -- an easy operation for the electronic
building blocks in a computer's arithmetic logic unit. To subtract decimal
3 (0011) from decimal 5 (0101), you would first work out the ones complement
of decimal 3 (1100), then add it to decimal 5 (1100+0101=10001), then,
removing the leftmost digit (1) and adding it as the end-around carry as
before, we get decimal 2 (0010).

Happily, the system also works for negative binary numbers where the sign
bit is the most significant bit. By converting the number to its ones
complement, you are simply creating a negative representation of the number:
in a four-bit binary system, decimal 3 would be represented by 0011, and -3
would be the ones complement, 1100. Unhappily, the ones complement system
has a fatal flaw: it has two representations for zero: 0000 (+0) and 1111
(-0).

That's why twos complement was invented. Twos complement simply adds 1 to
the ones complement, removing the +/-0 anomaly. The subtraction algorithm
remains the same, but using the twos complement instead of the ones
complement, we can now avoid the extra step of adding the end-around carry
(it is already done). To subtract decimal 3 (0011) from decimal 5 (0101),
you would first work out the twos complement of decimal 3 (1101), then add
it to decimal 5 (1101+0101=0010), note that the carry bit is shifted out and
lost as this is a four-bit binary system. Twos complement works for any
sized binary system (for a five bit system the calculation becomes
11101+00101=00010).

By now you will have realized that twos complement bears no relationship to
the number two, it is an simply an adjective differentiating twos complement
from ones complement.

IMO, your company's word list is correct.

Regards,
Dave.

****************************************************
David P. Whelan, Whelan Technical Services
mailto:dwhelan -at- ieee -dot- org
http://www.pangea.ca/~dwhelan
****************************************************

Previous by Author: Re: Charge for Travel Time?
Next by Author: Visually impaired technical writers
Previous by Thread: Re: Two's Complement
Next by Thread: Bay Area Brunch Update

What this post helpful? Share it with friends and colleagues: