This preview has intentionally blurred sections. Sign up to view the full version.View Full Document
Unformatted text preview: magnitude of the result is >= 2 n-1 b b For unsigned numbers: b Overflow occurs when there is an end-carry b For signed numbers: b Overflow occurs when there is a sign-reversal b We can detect the overflow when the carry-in does not equal the carry-out in the sign-bit CMPT 150 Integer Representation Page 4 Overflow b For example: b We can use an XOR gate to detect overflow CMPT 150 Integer Representation Page 5 2’s Complement Addition b Add the numbers together and discard the carry b E.g. for n=6 : CMPT 150 Integer Representation Page 6 2’s Complement Subtraction b Take 2’s complement of second operand and perform 2’s complement addition b n=5 , perform 10 10 – 3 10 b Now perform 3 10 – 10 10...
View Full Document
- Spring '08
- Addition, Negative and non-negative numbers, integer representation