4. Signed Numbers: 2's Complement Representation
In digital systems, we need a way to represent negative numbers. The 2's Complement method is the standard approach because it simplifies subtraction operations.
1's Complement
The 1's complement of a binary number is found by inverting all the bits (0 becomes 1, and 1 becomes 0).
- Example: $5_{10} = 0101_2$. 1's Complement is $1010_2$.
2's Complement
The 2's complement is found by taking the 1's complement and adding 1 to the result.
Steps to find -N using 2's Complement (8 bits):
- Start with the positive number N (e.g., $5_{10} = 00000101_2$).
- Find the 1's Complement: $11111010_2$.
- Add 1: $11111010 + 1 = 11111011_2$.
Thus, $-5_{10}$ is represented as $11111011_2$.
Key Feature: The Sign Bit
In 2's complement representation, the Most Significant Bit (MSB) determines the sign:
- 0: Positive number.
- 1: Negative number.
This system allows microprocessors to treat both addition and subtraction as simple addition, simplifying hardware design.