On Jul 14, 2010, at 1:47 PM, codemaker 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?
Integer constants are probably being treated as 16-bit. When you multiply two 16-bit integers the result is a 16-bit integer, and you are overflowing. Make sure you use 32-bit integer constants: tmpY = 2008L * 367L; -- Dave Carrigan d...@rudedog.org Seattle, WA, USA -- For information on using the ACCESS Developer Forums, or to unsubscribe, please see http://www.access-company.com/developers/forums/