Integer overflow: Difference between revisions

Content deleted Content added
Flags: change "...indicates than an overflow..." to "...indicates that an overflow..."
Line 32:
The [[carry flag]] is set when the result of an addition or subtraction, considering the operands and result as unsigned numbers, does not fit in the given number of bits. This indicates an overflow with a [[carry (arithmetic)|''carry''/''borrow'']] from the [[most significant bit]]. An immediately following ''add with carry'' or ''substract with borrow'' operation would use the contents of this flag to modify a register or a memory ___location that contains the higher part of a multi-word value.
 
The [[overflow flag]] is set when the result of an operation on signed numbers does not have the sign that one would predict from the signs of the operands, e.g. a negative result when adding two positive numbers. This indicates thanthat an overflow has occurred and the signed result represented in [[two's complement]] form would not fit in the given number of bits.
 
==Methods to mitigate integer overflow problems==