What would have been the condition for overflow, if instead of "**in terms of the carry generated**", the question had asked for "in terms of the carry **propagated**"?

The Gateway to Computer Science Excellence

First time here? Checkout the FAQ!

x

+8 votes

The condition for overflow in the addition of two $2's$ complement numbers in terms of the carry generated by the two most significant bits is ___________.

+9 votes

Best answer

The condition for overflow in the addition of two 2's complement numbers in terms of the carry generated by the two most significant bits is when carry on MSB but not From MSB, or Carry from MSB but not on MSB. i.e.,

$$C_{out} \oplus C_{n-1} = 1.$$

**i.e. For overflow to happen during addition of two numbers in 2's complement form**

They must have same sign and result is of opposite signOverflow occurs if

1. (+A) + (+B) = −C

2.(−A) + (−B) = +C

PS: Overflow is useful for signed numbers and useless for unsigned numbers

0

Vishal, Overflow is the condition when result produced by addition cannot be stored in space allocated. Say You Want to add $2$, 4-bit numbers, then if result produced after addition is 5-bit, then we cannot fit the result in 4-bit, And we say Overflow has happened.

In 2's complement representation $0111 = (7)_{10}$ And performing addition : $0111 + 0111$. Result obtained is $1110 = (-2)_10$, in 2's complement representation not $14$ which should be answer. But there is not way we could represent $14$ in 2's complement representation in 4-bits. So Overflow.

- All categories
- General Aptitude 1.3k
- Engineering Mathematics 5.2k
- Digital Logic 2k
- Programming & DS 3.7k
- Algorithms 3.2k
- Theory of Computation 4k
- Compiler Design 1.6k
- Databases 3k
- CO & Architecture 2.6k
- Computer Networks 3k
- Non GATE 1k
- Others 1.3k
- Admissions 488
- Exam Queries 436
- Tier 1 Placement Questions 18
- Job Queries 56
- Projects 9

36,201 questions

43,662 answers

124,111 comments

42,944 users