Course contentsShow
← Computer Science
Lesson 1059 of 2,87225. Computer Architecture FoundationsFree lesson

Two's Complement: The Standard for Signed Integers

Why two's complement became the universal hardware standard for signed integers and how it simplifies arithmetic.

Two's Complement: The Standard for Signed Integers

What You'll Learn

You'll discover why two's complement became the universal method for representing signed integers in computer hardware and how it elegantly simplifies arithmetic operations.

The Winning Design

Remember sign-magnitude and one's complement from previous lessons? Both had flaws: two representations for zero and clunky arithmetic circuits. Two's complement solved both problems and became the industry standard.

In two's complement, negative numbers are formed by inverting all bits of the positive number (like one's complement) and then adding 1. For example, with 4-bit integers:

  • 5 is 0101
  • Invert: 1010
  • Add 1: 1011 = -5 in two's complement

Why It Won

Single Zero: There's only one representation for zero (0000), unlike the previous methods. This eliminates special-case logic in hardware.

Addition Just Works: Here's the magic—you can add signed numbers using the exact same circuit as unsigned addition, ignoring any overflow bit. No special handling needed:

  0101 (5)
+ 1011 (-5)
------
 10000

Drop the overflow bit → 0000 (zero). Perfect!

Even mixing positive and negative works seamlessly:

  0011 (3)
+ 1110 (-2)
------
 10001

Drop overflow → 0001 (1). Correct again!

Hardware Simplicity: Subtraction becomes addition with a negated operand. Multiplication and division circuits work uniformly. One set of circuits handles all integer arithmetic, making CPUs faster, cheaper, and more power-efficient.

The Range Trade-off

With n bits, two's complement represents integers from -2^(n-1) to 2^(n-1) - 1. Notice the negative range is one larger—that's where the "extra" zero representation went!

Key Takeaway: Two's complement became universal because it unifies signed and unsigned arithmetic in hardware, requires only one zero, and dramatically simplifies CPU design—one arithmetic circuit does it all.