one's complement
One's complement is the second historical attempt at signed binary, a stepping stone between sign-magnitude and the two's complement we use today. The rule is beautifully simple: to negate a number, flip every bit — turn each 0 into a 1 and each 1 into a 0. So if +5 in 8 bits is 0000 0101, then -5 is its bit-by-bit flip, 1111 1010. The leftmost bit still ends up acting as a sign indicator (1 for negatives), but it is not stored separately as in sign-magnitude; the whole pattern is inverted.
Flipping the bits fixes one of sign-magnitude's headaches and creates a new one. The good news: addition works much better, because adding a number and its flipped form behaves sensibly. The catch is the end-around carry — when adding two one's complement numbers, any carry that falls off the left end must be added back in at the right, an extra step the hardware must perform. And the old curse remains: there are still two zeros. All-0s (0000 0000) is positive zero and all-1s (1111 1111), the flip of zero, is negative zero. That redundant pattern wastes a value and complicates comparisons.
One's complement was used in some real machines (the early CDC mainframes, for instance) and it still surfaces in one famous corner: the checksums in the Internet's IP, TCP, and UDP protocols are computed in one's complement arithmetic, end-around carry and all. For ordinary integer storage, though, it was superseded by two's complement, which removes the second zero and the end-around carry in one stroke. The honest summary: one's complement is a near miss — closer than sign-magnitude, but still one tweak short of ideal.
In 8-bit one's complement, +5 is 0000 0101 and -5 is its flip 1111 1010. Adding them gives 1111 1111 — which is negative zero, not the positive zero you might expect, showing why the double zero is annoying.
Negate by flipping every bit; but two zeros and an end-around carry remain.
One's complement still has two zeros and needs an end-around carry, so two's complement replaced it for integers. It lingers in Internet checksums (IP/TCP/UDP), which are defined in one's complement arithmetic.