(i) 1100 + 0100
(ii) 1100 + 1111
(iii) 0101 + 0100
(iv) 1010 + 1100
This question asks us to identify which additions performed using 4-bit 2's complement arithmetic result in an overflow. Overflow occurs when the outcome of an arithmetic operation is outside the range that can be represented by the given number of bits.
In 4-bit 2's complement representation, the range of numbers is from $-(2^{4-1})$ to $(2^{4-1} - 1)$, which is -8 to +7.
A key rule for detecting overflow in signed number addition is:
First, let's determine the values represented by the binary numbers:
Now, let's perform the addition:
1 |
1100 |
(-4) |
+ 0100 |
(+4) |
|
------- |
10000 |
Discarding the carry-out bit (the 5th bit), the 4-bit result is $0000$, which represents 0.
We added a negative number (-4) and a positive number (+4). The result is 0. Since the sign bits of the operands were different (1 and 0), overflow does not occur.
Values:
Addition:
1 |
1100 |
(-4) |
+ 1111 |
(-1) |
|
------- |
11011 |
Discarding the carry-out bit, the 4-bit result is $1011$.
$1011$: Sign bit is 1. 2's complement: invert ($0100$) + 1 = $0101$, which is 5. So, $1011$ represents -5.
We added two negative numbers (-4 and -1). The result (-5) is negative. Since the sign bits were the same (1 and 1) and the result's sign bit is also 1, no overflow occurred.
Values:
Addition:
0101 |
(+5) |
+ 0100 |
(+4) |
------- |
1001 |
The 4-bit result is $1001$.
$1001$: Sign bit is 1. 2's complement: invert ($0110$) + 1 = $0111$, which is 7. So, $1001$ represents -7.
We added two positive numbers (+5 and +4). The expected result is +9. However, the 4-bit result $1001$ represents -7. Since two positive numbers resulted in a negative number, overflow occurred.
Values:
Addition:
1 |
1010 |
(-6) |
+ 1100 |
(-4) |
|
------- |
10110 |
Discarding the carry-out bit, the 4-bit result is $0110$.
$0110$: Sign bit is 0, representing a positive number. It directly represents +6.
We added two negative numbers (-6 and -4). The expected result is -10. However, the 4-bit result $0110$ represents +6. Since two negative numbers resulted in a positive number, overflow occurred.
Based on the analysis:
Therefore, additions (iii) and (iv) result in overflow.
What is the full form of EBCDIC?
The 2's complement representation of the number (-100)10 in an 8 bit computer is
Consider the values A = 2.0 × 1030, B = -2.0 × 1030 C = 1.0. Assume, that the floating point numbers are represented with 32 bits. What are the values of X and Y, when the following sequence of operations are executed on a computer?
X = A + B
Y = A + C
X = X + C
Y = Y + B
Which of the following pairs of octal and binary numbers are NOT equal?