The real question, is, IMHO, "Is there an overflow carry when A+B get
added?"

So, if you right shift by 1 bit a and b, (i.e. divide each by 2) and then
add those divided numbers together, then the resulting answer will have the
high order bit set if the numbers when added (unshifted) would have caused
and "overflow".

There's probably an easy way to test this using subtraction...

You didn't want any sample code did you?  :)

Ed
----- Original Message -----
From: "Shekar Mantha" <[EMAIL PROTECTED]>
To: "Palm Developer Forum" <[EMAIL PROTECTED]>
Sent: Tuesday, November 28, 2000 10:22 PM
Subject: Re: a very naive question...


> Try using a unsigned long long type (64 bit arithmetic).
> ----- Original Message -----
> From: "Paul Nevai" <[EMAIL PROTECTED]>
> To: "Palm Developer Forum" <[EMAIL PROTECTED]>
> Sent: Tuesday, November 28, 2000 2:40 PM
> Subject: a very naive question...
>
>
> >
> > Suppose I use C in CW and I have
> >
> > UInt32 a, b;
> >
> > How can I determine if "a" and "b" are "huge" then (a + b) is not beyond
> > 0xFFFFFFFFF [max UInt32]?
> >
> > Is there a standard way of doing it?
> >
> > E.g, can I check if (a + b < a || a + b < b)? Does this make sense? Does
> my
> > question make sense?
> >
> > Best regards, Paul
> >
> > --
> > For information on using the Palm Developer Forums, or to unsubscribe,
> please see http://www.palmos.com/dev/tech/support/forums/
>
>
> --
> For information on using the Palm Developer Forums, or to unsubscribe,
please see http://www.palmos.com/dev/tech/support/forums/
>


-- 
For information on using the Palm Developer Forums, or to unsubscribe, please see 
http://www.palmos.com/dev/tech/support/forums/

Reply via email to