You need to use:

tmpY = 2008L * 367;

Since the multiply occurs before the assignment and both parameters of the 
multiply at Int16, you overflow.

Chris


Sent from my Palm Pre on AT&T
On Jul 14, 2010 3:54 PM, codemaker <kala...@yahoo.com> wrote: 

Hi 



I compile the following code in metroworks codewarrior v9.3 and I get a wrong 
calculation.



        UInt32 tmpY = 0; 

        

        tmpY = 2008 * 367;

        

        if (tmpY!=736936)

                InfoMSG("tmpY=%ld", tmpY);





I get 16040 instead of 736936. Do you know why?



-- 

For information on using the ACCESS Developer Forums, or to unsubscribe, please 
see http://www.access-company.com/developers/forums/



-- 
For information on using the ACCESS Developer Forums, or to unsubscribe, please 
see http://www.access-company.com/developers/forums/

Reply via email to