ELI5: Explain Like I'm 5

Two's complement

Two's complement is a way of representing numbers in computers. It's like a special code that makes it easier to do math with numbers. Instead of having two symbols like in regular math ─ positive (+) and negative (-) ─ in two's complement you only use positive numbers. These numbers are made to represent both positive and negative numbers by how they are read.

For example, let's say the two's complement code uses the numbers 0, 1, 2, and 3. The code starts counting from 0 and if it reaches 4, it goes back to 0. So in two's complement, 0 is 0, 1 is 1, 2 is 2, 3 is 3, 4 is -4, 5 is -3, 6 is -2, 7 is -1, and 8 is 0 again.

By using this code, a computer can do math with negative numbers very quickly. In regular math, if you add -5 and 3, you would have -2. But in two's complement, you would add the two's complement code numbers 7 (for -5) and 3 (for 3). Then the answer would show up as 0 (for -2).

So two's complement make it much faster and easier for computers to do math with negative numbers.