MGMT 1030 Lecture Notes - Lecture 36: Overflow Flag
![](https://new-preview-html.oneclass.com/Z7g9MEk45YyLQAbWYPKBm3qP8rleDpO6/bg1.png)
MGMT 1030 Lecture 36 Notes – Overflow and Carry Conditions
Introduction
• It is useful to be able to predict approximate sizes of integers that are represented in
complementary form without going through the conversion.
• A few hints will help positive numbers are always represented by themselves.
• Since they always start with 0, they are easily identified.
• Small negative numbers, that is, negative numbers close to 0, have representations that
start with large numbers of 1s.
• The uer − i 8-it ’s opleet, for eaple, is represeted
hereas −8
• The largest egatie ’s opleet uer, is represeted
• This is evident from the scale
• Since there is only a difference in value of 1 between 1’s ad ’s opleet
representations of negative numbers (positive numbers are, of course, identical in both
representations)
• You can get a quick idea of the value in either representation simply by inverting all the
1s and 0s and approximating the value from the result.
• We noted earlier in this discussion that overflows occur when the result of a calculation
does not fit into the fixed number of bits available for the result.
• I ’s opleet, a additio or sutratio oerflo ours he the result
overflows into the sign bit.
• Thus, overflows can occur only when both operands have the same sign and can be
detected by the fact that the sign of the result is opposite that of the operands.
• Computers provide a flag that allows a programmer to test for an overflow condition.
• The overflow flag is set or reset each time a calculation is performed by the computer.
• In addition, the computer provides a carry flag that is used to correct for carries and
borrows that occur when large numbers must be separated into parts to perform
additions and subtractions.
find more resources at oneclass.com
find more resources at oneclass.com