LOGBOOK

HELP

Quiz Entry - updated: 2026.07.07

What is the relationship between -x and ~x + 1 in two's complement?

They're equal: −x == ~x + 1. This is two's-complement negation.

This is the fundamental negation property of two's complement.

Proof:

x + ~x = 111...1 = -1  (each bit position: 0+1 or 1+0 = 1)
Therefore: ~x = -1 - x = -(x + 1)
So: ~x + 1 = -x

Useful applications:

  • Computing -x without subtraction hardware
  • Finding lowest set bit: x & (-x) = x & (~x + 1)
  • Checking if power of 2: x & (x - 1) == 0

From Quiz: REVE1 / Number Representations | Updated: Jul 07, 2026