This is the mail archive of the
gcc-bugs@gcc.gnu.org
mailing list for the GCC project.
Re: c++/3005
- To: gcc-bugs at gcc dot gnu dot org, gcc-prs at gcc dot gnu dot org, mvishnu at calix dot com, nobody at gcc dot gnu dot org
- Subject: Re: c++/3005
- From: lerdsuwa at gcc dot gnu dot org
- Date: 3 Jun 2001 09:41:09 -0000
Synopsis: improper evaluation of mixed mode expressions involving long long
State-Changed-From-To: open->closed
State-Changed-By: lerdsuwa
State-Changed-When: Sun Jun 3 02:41:08 2001
State-Changed-Why:
Not a bug. The expression n*424*1000000/mi is computed as
((n*424)*1000000)/mi. The subexpression (n*424)*1000000
involves only 'int' quantities and therefore it is evaluated
using 'int' precision. The errornous result is then
converted to unsigned long long when dividing by 'mi'.
To get the desired behavior, cast 'n' to unsigned long long.
http://gcc.gnu.org/cgi-bin/gnatsweb.pl?cmd=view&pr=3005&database=gcc