Difference between revisions of "One's complement"

From Computer History Wiki
Jump to: navigation, search
(Somewhat duplicative of content elsewhere)
(No difference)

Revision as of 17:48, 12 May 2021

One's complement is the original system for representing integers (both positive and negative) in binary; if the high bit (the 'sign' bit) is '1', the number is negative; if '0', the remaining bits encode either 0 (if all '0'), or a positive number. 0 has a second representation (sometimes called '-0'), with all bits (including the sign bit) set to '1'.

Negative numbers are formed by taking the positive number, and complementing it (bit-by-bit inversion). So. for example, using a 4-bit word, 1 is '0001'; to get -1, invert, which gives '1110'.