<<< | Index | Binary Arithmetic >>> |
Arithmetic operations have a potential to run into a condition known as overflow.
Overflow occurs with respect to the size of the data type that must accommodate the result.
Overflow indicates that the result was too large or too small to fit in the original data type.
When two signed 2's complement numbers are added, overflow is detected if:
both operands are positive and the result is negative, or
both operands are negative and the result is positive.
When two unsigned numbers are added, overflow occurrs if
there is a carry out of the leftmost bit.
<<< | Index | Binary Arithmetic >>> |