I know that in the case of a 16 bit word, if we have x - 115 in decimal, the smallest x that would cause overflow would be (32767 + 115 + 1)= 32883 because it would represent a number that is larger than the largest positive integer we could represent in a 16 bit word. However, I was wondering what would the largest value of x be? would it be (2^16)? which would cause 2 carries after the addition. Or would the largest x be a number that would only result in 1 carry alone?
$\begingroup$
$\endgroup$
You get overflow if the result is larger than the maximal integer, in this case 32767. You get underflow if it is smaller than the minimal one, in this case -32768. (In the context of floating-point operations, underflow happens when a non-zero number is rounded to zero.)
-
$\begingroup$ If you look at my question, that's exactly what I have explained. My question is not really that though. I would like to know what would the largest value of x be(not the largest integer value as the result) that will cause overflow? is it going to be (2^16 - 1), since this is the largest number the a 16 bit word could represent? $\endgroup$ – O.A. Sep 28 '14 at 22:23
-
$\begingroup$ The largest value of $x$ that will cause overflow cannot be 65535, since a 16 bit signed integer cannot hold that number. $\endgroup$ – Yuval Filmus Sep 28 '14 at 23:00