Professional Documents
Culture Documents
Week 2 - Number System Numeric Complements
Week 2 - Number System Numeric Complements
Week 2 - Number System Numeric Complements
Number Representation
Negative Numbers
How do we represent negative numbers in a word length of n bits?
where N* =
e.g., n = 4
2n = 1610 = 10000
+6 = 0110
-6 = 10000 - 0110 =
-1 =
Week 002: Number System & Numeric Complements
where Ñ =
e.g., n = 4
2n - 1 = 16 - 1 = 15 = 10000 - 1
-6 = 1111 - 0110
-1 =
Week 002: Number System & Numeric Complements
6=0110 1=0001
-6 = -1 =
N* = 2n - N = (2n - 1 - N) + 1
6=0110
-6 =
Week 002: Number System & Numeric Complements
2′ 𝑠
Thus, given a negative number in { ′ } complement representation,
1𝑠
2′ 𝑠
we can obtain the magnitude of that number by taking the {′ }
1𝑠
N∗
complement of { }.
Ñ
+6 0110
+1 0001
Correct answer.
Week 002: Number System & Numeric Complements
+6 0110
+2 0010
Overflow! - too big a number!
+1 0001
-6 1010
Correct answer. How do we know?
Week 002: Number System & Numeric Complements
+6 0110
-2 1110
+4
Correct answer.
Ignore carry from sign bit. Not an overflow.
Week 002: Number System & Numeric Complements
-6 1010
-3 1101
-9
Wrong answer because of overflow:
-9 is too large to be represented in a
4 bit number (including sign).
Week 002: Number System & Numeric Complements
2 0010
-6
- 4
Correct answer.
Week 002: Number System & Numeric Complements
-2
+6 0110
+4 Correct answer? No, add carry to LSB
No overflow.
Week 002: Number System & Numeric Complements
-4 1011
-2 1101
-6
Correct answer with end around carry;
no overflow.
Week 002: Number System & Numeric Complements