MGMT 1030 Lecture Notes - Lecture 31: Statistical Hypothesis Testing
MGMT 1030 Lecture 31 Notes – Overflow
Introduction
• Remember, too, that you must check for overflow to make sure that your number is still
in range in the new base.
• Here are several eaples of ’s opleet additio ad sutratio
• Together with the equivalent decimal results
• EXAMPLE
• Add 00101101 = 45 00111010 = 58 01100111 = 103 Add the 16- bit numbers
= = − = −
• Note that the addend 1111111111000101 is the inversion of the value in the example
with eight additional 0s required to fill up 16 bits.
• The deial result, −, is foud ivertig to
to get a positive magnitude and adding up the bits.
• EXAMPLES Add 01101010 11111101 101100111 +1 01101000 = = = 106 –2 104 (end-
around carry)
• Sutrat = − =
• Changing the sign of the addend by inverting 01101010 10100101 100001111 +1
00010000 =16 (end-around carry)
• Add = + = = −
• This is an obvious example of overflow.
• The correct positive result, 129, exceeds the range for 8 bits.
• Eight bits can store 256 numbers
• Splitting the range only allows positive values 0–127.
• The overflow situation shown in the last example occurs commonly in the computer,
and some high-level languages do not check adequately.
• In some versions of BASIC, for example, the sum 16384 + 16386 will show an incorrect
result of − or −.
find more resources at oneclass.com
find more resources at oneclass.com