public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
* [Bug c++/14989] New: strange double resolution
@ 2004-04-17 5:29 wxy at kivera dot com
2004-04-17 5:34 ` [Bug c++/14989] " wxy at kivera dot com
2004-04-17 5:39 ` [Bug target/14989] " pinskia at gcc dot gnu dot org
0 siblings, 2 replies; 3+ messages in thread
From: wxy at kivera dot com @ 2004-04-17 5:29 UTC (permalink / raw)
To: gcc-bugs
here is gcc -v:
Reading specs from /exp/opt/gcc3/lib/gcc-lib/i686-pc-linux-gnu/3.3.3/specs
Configured with: ../gcc-3.3.3/configure --prefix=/exp/opt/gcc3
Thread model: posix
gcc version 3.3.3
here is the source code big.cc:
#include <cstdio>
int main() {
#ifdef SINGLE
long long a = 8000000000000000000ll, b = a + 1;
#else
long long p = 2000000ll, a = p * p * p, b = a + 1;
#endif
double x = a, y = b;
#ifdef PRINT
printf("%lld %lld\n", a, b);
#endif
printf("%s %s\n", a == b ? "yes" : "no", x == y ? "yes" : "no");
}
note:
a and b are 8 byte long long differ by 1 with magnitude of 63 bits. x and y are
8 byte double with only 53 bits resolution. When x and y are assigned the value
of a and b, they should have same value, and the last line should print no yes.
If I compile with (gcc -Wall -O big.cc), the program prints (unexpected) no no.
If I compile with (gcc -Wall big.cc) or (gcc -Wall -O -DSINGLE big.cc) or (gcc
-Wall -O -DPRINT big.cc), I get the expected "no yes". I am puzzled by the fact
that -DSINGLE or -DPRINT made a difference.
--
Summary: strange double resolution
Product: gcc
Version: 3.3.3
Status: UNCONFIRMED
Severity: normal
Priority: P2
Component: c++
AssignedTo: unassigned at gcc dot gnu dot org
ReportedBy: wxy at kivera dot com
CC: gcc-bugs at gcc dot gnu dot org
GCC host triplet: i686-pc-linux-gnu
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=14989
^ permalink raw reply [flat|nested] 3+ messages in thread
* [Bug c++/14989] strange double resolution
2004-04-17 5:29 [Bug c++/14989] New: strange double resolution wxy at kivera dot com
@ 2004-04-17 5:34 ` wxy at kivera dot com
2004-04-17 5:39 ` [Bug target/14989] " pinskia at gcc dot gnu dot org
1 sibling, 0 replies; 3+ messages in thread
From: wxy at kivera dot com @ 2004-04-17 5:34 UTC (permalink / raw)
To: gcc-bugs
------- Additional Comments From wxy at kivera dot com 2004-04-17 05:27 -------
on solaris, it works as expected, everything prints no yes.
here is gcc -v:
Reading specs from
/net/mars/exp/opt/gcc/lib/gcc-lib/sparc-sun-solaris2.8/3.3.3/specs
Configured with: ../gcc-3.3.3/configure --prefix=/net/mars/exp/opt/gcc
Thread model: posix
gcc version 3.3.3
--
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=14989
^ permalink raw reply [flat|nested] 3+ messages in thread
* [Bug target/14989] strange double resolution
2004-04-17 5:29 [Bug c++/14989] New: strange double resolution wxy at kivera dot com
2004-04-17 5:34 ` [Bug c++/14989] " wxy at kivera dot com
@ 2004-04-17 5:39 ` pinskia at gcc dot gnu dot org
1 sibling, 0 replies; 3+ messages in thread
From: pinskia at gcc dot gnu dot org @ 2004-04-17 5:39 UTC (permalink / raw)
To: gcc-bugs
------- Additional Comments From pinskia at gcc dot gnu dot org 2004-04-17 05:29 -------
This is a dup of bug 323, read that bug and see why it is considered a non-bug.
*** This bug has been marked as a duplicate of 323 ***
*** This bug has been marked as a duplicate of 323 ***
--
What |Removed |Added
----------------------------------------------------------------------------
Status|UNCONFIRMED |RESOLVED
Component|c++ |target
Resolution| |DUPLICATE
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=14989
^ permalink raw reply [flat|nested] 3+ messages in thread
end of thread, other threads:[~2004-04-17 5:29 UTC | newest]
Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2004-04-17 5:29 [Bug c++/14989] New: strange double resolution wxy at kivera dot com
2004-04-17 5:34 ` [Bug c++/14989] " wxy at kivera dot com
2004-04-17 5:39 ` [Bug target/14989] " pinskia at gcc dot gnu dot org
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).