Signed Numbers
Overview
Signed numbers in digital systems allow representation of both positive and negative values. Various methods exist for representing signed numbers, with two’s complement being the most widely used in modern computers. Understanding signed number representations is crucial for arithmetic operations and data processing in digital systems.
Detailed Explanation
Representation Methods
1. Sign-Magnitude
+5: 0101 (0 = positive)
-5: 1101 (1 = negative)
2. One's Complement
+5: 0101
-5: 1010 (invert all bits)
3. Two's Complement
+5: 0101
-5: 1011 (invert + add 1)
Sign Bit Conventions
MSB (Most Significant Bit):
0 → Positive number
1 → Negative number
8-bit Example:
0xxx xxxx → Positive range
1xxx xxxx → Negative range
Comparison Table
Method | Range (8-bit) | Zero Forms
---------------|---------------|------------
Sign-Magnitude | -127 to +127 | +0, -0
One's Comp | -127 to +127 | +0, -0
Two's Comp | -128 to +127 | One zero
Sign Extension
4-bit to 8-bit:
Positive: 0101 → 0000 0101
Negative: 1011 → 1111 1011
Rule: Copy the sign bit to all new positions
Practice Problems
-
Convert between representations:
- +42 in all three formats
- -15 in all three formats
- Compare ranges and ease of use
-
Perform sign extension:
- 0110 to 8 bits
- 1101 to 8 bits
- 0011 to 12 bits
References
- Digital Logic Design by Morris Mano
- Computer Architecture by Patterson & Hennessy
- Signed Number Representations