[Bug c/19765] New: GCC math operations can fail with type double
gcc-bugzilla at gcc dot gnu dot org
gcc-bugzilla@gcc.gnu.org
Wed Feb 2 17:05:00 GMT 2005
simple subtraction works for small values of doubles, but fails for larger values
TEST CODE FOLLOWS:
int main (int argc, char **argv)
{
double n1, n2;
n1=74925983.0;
n2=n1-1;
if (n1==n2) printf ("BUG: the numbers are equal.\n");
else printf ("NO BUG: the numbers are different\n");
n1=3275892374984327984327498274925983.0;
n2=n1-1;
if (n1==n2) printf ("BUG: the numbers are equal.\n");
else printf ("NO BUG: the numbers are different\n");
return (0);
}
COMPILE WITH: gcc -o test test.c
EXECUTE: ./test
Environment:
System: Linux bubbles 2.6.11-rc1 #1 SMP Thu Jan 27 02:57:53 MST 2005 i686 Intel(R) Pentium(R) 4 CPU 2.80GHz GenuineIntel GNU/Linux
Architecture: i686
host: i686-pc-linux-gnu
build: i686-pc-linux-gnu
target: i686-pc-linux-gnu
configured with: /var/tmp/portage/gcc-3.3.3-r6/work/gcc-3.3.3/configure --prefix=/usr --bindir=/usr/i686-pc-linux-gnu/gcc-bin/3.3 --includedir=/usr/lib/gcc-lib/i686-pc-linux-gnu/3.3.3/include --datadir=/usr/share/gcc-data/i686-pc-linux-gnu/3.3 --mandir=/usr/share/gcc-data/i686-pc-linux-gnu/3.3/man --infodir=/usr/share/gcc-data/i686-pc-linux-gnu/3.3/info --enable-shared --host=i686-pc-linux-gnu --target=i686-pc-linux-gnu --with-system-zlib --enable-languages=c,c++ --enable-threads=posix --enable-long-long --disable-checking --disable-libunwind-exceptions --enable-cstdio=stdio --enable-version-specific-runtime-libs --with-gxx-include-dir=/usr/lib/gcc-lib/i686-pc-linux-gnu/3.3.3/include/g++-v3 --with-local-prefix=/usr/local --enable-shared --enable-nls --without-included-gettext --disable-multilib --enable-__cxa_atexit --enable-clocale=generic
How-To-Repeat:
The test program shows when the bug does/doesnt occur.
------- Additional Comments From nelson at bubbles dot reversion dot ccn 2005-02-02 17:05 -------
Fix:
I dont know how to fix this.
--
Summary: GCC math operations can fail with type double
Product: gcc
Version: 3.3.3
Status: UNCONFIRMED
Severity: critical
Priority: P2
Component: c
AssignedTo: unassigned at gcc dot gnu dot org
ReportedBy: nelson at bubbles dot reversion dot ccn
CC: gcc-bugs at gcc dot gnu dot org
GCC build triplet: i686-pc-linux-gnu
GCC host triplet: i686-pc-linux-gnu
GCC target triplet: i686-pc-linux-gnu
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=19765
More information about the Gcc-bugs
mailing list