From: C R Johnson <iamcliff@ix.netcom.com>
Subject: small doubles, g++, glibc, and linux/alpha problems
Date: 1998/03/08 [thread overview]
Message-ID: <3503303E.3E5B5838@ix.netcom.com> (raw)
g++ 2.7 and egcs 1.0.1 running on a linux-alpha-glibc
system
is not taking kindly to small double values - those funky
near zero values that you know should be zero, but have
stupid values
like 2.38723e-314.
The problem does not show itself on my linux-intel-glibc
system.
#include <iostream.h>
#include <cmath>
int main()
{
cerr << "hello" << endl;
double u = 2.38723e-314;
cerr << "u = " << u << " M_PI = " << M_PI << endl;
cerr << "u * M_PI = " << u * M_PI << endl;
return 0;
}
The results:
on linux - alpha - glibc
+++++++++++++++++++++++++++++++++++++
[cliff@van cliff]$ g++ hello.c++ -g -o hello <-- using gcc
2.7.1
[cliff@van cliff]$ ./hello
hello
u = Floating point exception (core dumped)
[cliff@van cliff]$ eg++ hello.c++ -g -o hello <-- using
egcs 1.0.1
[cliff@van cliff]$ ./hello
hello
u = 2.38723e-314 M_PI = 3.14159
u * M_PI = Floating point exception (core dumped)
slightly different results, but both hosed.
on linux - intel - glibc
+++++++++++++++++++++++++
[cliff@brother_brent cliff]$ eg++ hello.c++ -g -o hello
[cliff@brother_brent cliff]$ hello
hello
u = 2.38723e-314 M_PI = 3.14159
u * M_PI = 7.4997e-314
No problem ( with either compiler ) .
Can anybody explain this? Is it a known problem? Can it be
fixed. Must I
resort to float's?
Thanks for any help.
cliff
next reply other threads:[~1998-03-08 5:00 UTC|newest]
Thread overview: 3+ messages / expand[flat|nested] mbox.gz Atom feed top
1998-03-08 5:00 C R Johnson [this message]
1998-03-08 5:00 ` small doubles, g++, glibc, and linux/alpha problems H.W. Stockman
1998-03-09 5:00 ` Michal Jaegermann
read-only archive
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox