Two's Complement
Learn how the two's complement solves both problems of SMR.
How two’s complement solves problems
The two’s complement solves both problems of SMR. First, it allows the CPU adder to operate negative numbers in one step. We need two steps for that when using the one’s complement. Second, the two’s complement has only one way to represent zero.
Positive integers in the two’s complement and SMR look the same. The highest-order bit equals zero. The remaining bits store the number.
Negative integers in the two’s complement have the highest-order bit equal to one. The rest of the bits are inverted the same way as in the one’s complement. The only difference is that we need to add one to the negative number after inverting its bits.
Get hands-on with 1200+ tech skills courses.