I think you just need to reverse the comparison operators in Dave's earlier
post

On Sat, Aug 27, 2011 at 10:59 PM, Dave <[email protected]> wrote:

> @Abishek: I was brain-dead in my earlier posting. Let me try again:
>
> If either number is zero, the sum will not overflow.
> If the numbers have different signs, the sum will not overflow.
> If both numbers are positive, overflow will occur if b > maxint - a.
> If both numbers are negative, overflow will occur if b < -maxint - a -
> 1.
>
> Dave
>
> On Aug 27, 12:18 pm, Abhishek <[email protected]> wrote:
> > @Dave: i didn't understand,
> > suppose a=30000, b=31000 and MaxInt=32000;
> > you are saying if (MaxInt-a)>=b; then overflow will occur. but here
> > condition is not satisfying.
> > plz explain.
>
> --
> You received this message because you are subscribed to the Google Groups
> "Algorithm Geeks" group.
> To post to this group, send email to [email protected].
> To unsubscribe from this group, send email to
> [email protected].
> For more options, visit this group at
> http://groups.google.com/group/algogeeks?hl=en.
>
>


-- 
Dipit Grover
B.Tech in CSE
IIT Roorkee

-- 
You received this message because you are subscribed to the Google Groups 
"Algorithm Geeks" group.
To post to this group, send email to [email protected].
To unsubscribe from this group, send email to 
[email protected].
For more options, visit this group at 
http://groups.google.com/group/algogeeks?hl=en.

Reply via email to