One’s Complement
Overview
One’s complement is a method of representing negative numbers in binary by inverting all bits of the positive number. This system provides a way to perform subtraction using addition circuits, though it has the peculiarity of having two representations for zero (+0 and -0). Understanding one’s complement is crucial for digital arithmetic and forms the basis for the more commonly used two’s complement system.
Detailed Explanation
Formation Rules
1. Positive numbers: Same as regular binary
2. Negative numbers: Invert all bits (1→0, 0→1)
Example (4-bit):
+5: 0101
-5: 1010 (invert all bits)
Range (n bits)
Positive: 0 to +(2ⁿ⁻¹-1)
Negative: -(2ⁿ⁻¹-1) to -0
4-bit example:
+7 (0111) to +0 (0000)
-7 (1000) to -0 (1111)
Addition Examples
1. Regular Addition:
0101 (+5)
+ 0011 (+3)
-------
1000 (+8)
2. With End-Around Carry:
0101 (+5)
+ 1010 (-5)
-------
1111 (-0)
0000 (+0)
Truth Table (4-bit)
Number | Binary | One's Complement
-------|--------|----------------
+7 | 0111 | 0111
+6 | 0110 | 0110
+5 | 0101 | 0101
+4 | 0100 | 0100
+3 | 0011 | 0011
+2 | 0010 | 0010
+1 | 0001 | 0001
+0 | 0000 | 0000
-0 | 1111 | 1111
-1 | 1110 | 1110
-2 | 1101 | 1101
-3 | 1100 | 1100
-4 | 1011 | 1011
-5 | 1010 | 1010
-6 | 1001 | 1001
-7 | 1000 | 1000
Practice Problems
-
Find one’s complement:
- 1100 1010
- 0011 0110
- 1111 0000
-
Perform using one’s complement:
- (+6) + (-3)
- (-4) + (+4)
- (-7) + (-1)