Usenet comp.os.linux.alpha (1997-2013)
 help / color / mirror / Atom feed
* small doubles, g++, glibc, and linux/alpha problems
@ 1998-03-08  5:00 C R Johnson
  1998-03-08  5:00 ` H.W. Stockman
  1998-03-09  5:00 ` Michal Jaegermann
  0 siblings, 2 replies; 3+ messages in thread
From: C R Johnson @ 1998-03-08  5:00 UTC (permalink / 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



^ permalink raw reply	[flat|nested] 3+ messages in thread

end of thread, other threads:[~1998-03-09  5:00 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
1998-03-08  5:00 small doubles, g++, glibc, and linux/alpha problems C R Johnson
1998-03-08  5:00 ` H.W. Stockman
1998-03-09  5:00 ` Michal Jaegermann

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox