twos complement

twos complement

(data)A system used in some computers to represent negativenumbers in binary. Each bit of the number is inverted(zeros are replaced with ones and vice versa), as for ones complement, but then one (000...0001) is added (ignoringoverflow). This avoids the two representations for zero foundin ones complement by using all ones to represent -1.

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

This representation simplifies the logic required for additionand subtraction, at the expense of a little extra complexityfor negation.