Professional Documents
Culture Documents
Overflow
Overflow condition in signed-magnitude number
• If calculation result exceeds the range -2n-1 – 1 to +2n-1 -1 and the signed bit of answer to
change occurring an overflow.
• Let us consider the addition of two signed-magnitude 4-bit numbers.
Overflow condition in 2’s Complement
number
When 4-bit signed numbers in 2's complement are used, which of the following operations
will cause either an overflow or an underflow?
a) Add B to A when A is 0110 and B is 1111.
b) Add B to A when A is 1110 and B is 0110.
c) Subtract B from A when A is 0111 and B is 1010.
d) Subtract B from A when A is 1111 and B is 1111.
Two’s Complement to Decimal Conversion
• Converting an eight-bit two's complement number to decimal.
• If the number is negative or positive by looking at the sign bit.
• If it is positive, simply convert it to decimal. If it is negative, make it positive by
inverting the bits and adding one. Then, convert the result to decimal. The
negative of this number is the value of the original binary.