Quiz Entry - updated: 2026.07.07
How do you negate a number in two's complement?
Flip every bit, then add 1: −x = ~x + 1.
Example: Negate 5 (0101):
Original: 0101 (+5)
Complement: 1010
Add 1: 1011 (-5) ✓
Example: Negate -5 (1011):
Original: 1011 (-5)
Complement: 0100
Add 1: 0101 (+5) ✓
Special case: Negating TMin gives TMin (overflow)
TMin: 1000...0
~TMin: 0111...1
+1: 1000...0 (back to TMin!)
Tip: "Flip and add 1" - the universal two's complement negation formula.
Go deeper:
Two's complement (Wikipedia) — see the "Working from LSB" and negation sections for why flip-and-add-1 works.