ones complement

ones complement

A system used in some computers to represent negativenumbers. To negate a number, each bit of the number isinverted (zeros are replaced with ones and vice versa). Thishas the consequence that there are two reperesentations forzero, either all zeros or all ones.

...000...00011 = +3000...00010 = +2000...00001 = +1000...00000 = +0111...11111 = -0111...11110 = -1111...11101 = -2111...11100 = -3...

Naive logic for ones complement addition might easily concludethat -0 + 1 = +0.

The twos complement avoids this by using all ones torepresent -1.