In a 2's complement representation an overflow is the result of arithmetic operations exceeding the upper or lower bounds of the representation range. In your example a 4-bit quantity can represent any number in the range [-8,...,+7]. Any result outside that range is an overflow. If you look at the datasheet for a processor with an overflow condition code, you will see a Boolean equation for overflow. IIRC it involves the sign of the result and the signs of the operands.

In a 2's complement representation an overflow is the result of arithmetic operations exceeding the upper or lower bounds of the representation range. In your example a 4-bit quantity can represent any number in the range [-8,...,+7]. Any result outside that range is an overflow. If you look at the datasheet for a processor with an overflow condition code, you will see a Boolean equation for overflow. IIRC it involves the sign of the result and the signs of the operands.

You have to pick a representation. The 4-bit quantities are either unsigned or signed 2's complement or they could be signed 1s complement or any other variety of representation. Once we know what is the intended representation we can tell what "overflow" means.

In your first example you have an "expectation" that you can represent +8 as the sum of +3 and +5. This is nonsense since +8 is not a representable number in 2's complement signed notation.

If overflow occurs, means we do not need to care for the result or the output ? We can ignore ?

Thanks !

Click to expand...

If overflow occurs, then the number that you just calculated will mess up some other future calculation, which in turn can result in nothing or a nuclear disaster if the system that had the overflow is part of nuclear reactor control system.

You are the designer. If overflow is ok with you, then it is ok with us. If it kills you, we don't care.

If overflow occurs, then the number that you just calculated will mess up some other future calculation, which in turn can result in nothing or a nuclear disaster if the system that had the overflow is part of nuclear reactor control system.

You are the designer. If overflow is ok with you, then it is ok with us. If it kills you, we don't care.