๐ฅจ Binary Complement Forms
Complements are alternate representations of numbers that enable subtraction via addition. Theyโre used in digital systems to simplify arithmetic operations, especially subtraction and signed number representation.
There are two major types:
- Diminished Complement: One less than the full radix complement
- Non-Diminished (Radix) Complement: The full complement relative to the base
Refer to Derivation of Method of Complements to understand why
๐ข Decimal Examples
Letโs use base-10 (decimal) to illustrate:
1. Diminished Complement (9โs Complement)
- Defined as: $10^n - 1 - N$
- Example: For 3-digit number 123 โ $999 - 123 = 876$
- Used in manual subtraction methods
2. Non-Diminished Complement (10โs Complement)
- Defined as: $10^n - N$
- Example: For 3-digit number 123 โ $1000 - 123 = 877$
- Enables subtraction via addition with carry discard
๐ป Binary Counterparts
In binary (base-2), these concepts map directly to:
| Decimal Concept | Binary Equivalent | Name |
|---|---|---|
| Radix Complement | $2^n - N$ | 2โs Complement |
| Diminished Radix Complement | $2^n - 1 - N$ | 1โs Complement |
**2’s Complement โโโโ $2^n - N$ **1’s Complement โโโโ $2^n - 1 - N$
- Thus we notice that:
1's Complement=2's Complement-1
- Or similarly:
2's Complement=1's Complement+1
๐ 1โs Complement (Diminished)
- Operation: Bitwise inversion (flip all bits)
Refer to Binary Complements Derivation to understand why
- Example:
0101โ1010 - Used historically in older systems
- Requires end-around carry during addition
Properties of 1’s Complement
- Two representations of zero:
0000(+0) and1111(โ0) - Subtraction via: $A + (\text{1โs complement of B}) + \text{carry}$
๐ 2โs Complement (Non-Diminished)
- Operation: Bitwise inversion + 1
Refer to Binary Complements Derivation to understand why
- Example:
0101โ1010โ1011 - Dominant in modern computing
- No need for end-around carry
Properties of 2’s Complement
- Single representation of zero:
0000 - Arithmetic is bitwise consistent
- Overflow detection is straightforward
- Enables signed number representation and subtraction using addition
๐ง Why 2โs Complement Is Preferred
- Hardware simplicity: Same adder circuit handles both addition and subtraction
- No ambiguity: Only one zero
- Efficient overflow detection: Based on carry into and out of MSB
- Bitwise consistency: Arithmetic works identically across bit widths
๐งผ Summary Table
| Complement Type | Formula | Binary Form | Notes |
|---|---|---|---|
| Diminished (9โs) | $10^n - 1 - N$ | 1โs Complement | Requires end-around carry |
| Non-Diminished (10โs) | $10^n - N$ | 2โs Complement | Preferred in hardware |
| 1โs Complement | Bitwise NOT | ~N | Two zeros, legacy use |
| 2โs Complement | ~N + 1 | -N | Single zero, modern standard |
Last updated on