public inbox for gcc-prs@sourceware.org
help / color / mirror / Atom feed
* c++/3005: improper evaluation of mixed mode expressions involving long long
@ 2001-05-30 10:46 mvishnu
0 siblings, 0 replies; only message in thread
From: mvishnu @ 2001-05-30 10:46 UTC (permalink / raw)
To: gcc-gnats
>Number: 3005
>Category: c++
>Synopsis: improper evaluation of mixed mode expressions involving long long
>Confidential: no
>Severity: serious
>Priority: high
>Responsible: unassigned
>State: open
>Class: sw-bug
>Submitter-Id: net
>Arrival-Date: Wed May 30 10:46:01 PDT 2001
>Closed-Date:
>Last-Modified:
>Originator: Meenan Vishnu
>Release: 2.95.3
>Organization:
>Environment:
/home/mvishnu/Simulation > g++ -v
Reading specs from /usr/local/lib/gcc-lib/sparc-sun-solaris2.7/2.95.3/specs
gcc version 2.95.3 20010315 (release)
/home/mvishnu/Simulation > uname -a
SunOS petuxa08 5.7 Generic_106541-12 sun4u sparc SUNW,Ultra-80
>Description:
#include <iostream>
int main()
{
double r;
int n = 38;
unsigned long long mi = 16960000;
r = n * 424 * 1000000 / mi;
cout << "r = " << r << endl;
unsigned long long t = n;
double r1;
r1 = t * 424 * 1000000 / mi;
cout << "r1 = " << r1 << endl;
}
>How-To-Repeat:
Compile the above (small) program using g++ (version 2.95.3) and run. The value of r should be 950. Instead,
it prints r = 1.08766e+12
>Fix:
A simple work around is also shown in the program. Use
a temporary variable t as shown in the computation of r1.
>Release-Note:
>Audit-Trail:
>Unformatted:
^ permalink raw reply [flat|nested] only message in thread
only message in thread, other threads:[~2001-05-30 10:46 UTC | newest]
Thread overview: (only message) (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2001-05-30 10:46 c++/3005: improper evaluation of mixed mode expressions involving long long mvishnu
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).