c++/3005
lerdsuwa@gcc.gnu.org
lerdsuwa@gcc.gnu.org
Sun Jun 3 02:41:00 GMT 2001
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
More information about the Gcc-bugs
mailing list