[Discuss] Test for positive gives wacko results for underflowed
values for the gcc compiler suite (including the gcc compiler,
and g77 and gfortran compilers)
Alan W. Irwin
irwin at beluga.phys.uvic.ca
Mon Jun 25 16:44:17 PDT 2007
Here is a simpler test
int main(void) {
double x=1.e-305, xscale=1.e+305;
double y;
int greater;
greater = (x/xscale) > 0.e0;
printf("%5.1d\n",greater);
y = x/xscale;
greater = y > 0.e0;
printf("%5.1d\n", greater);
}
with the result
1
0
So the fundamental question is why are the results for (x/xscale) > 0.e0;
and y > 0.e0; different?
Alan
__________________________
Alan W. Irwin
Astronomical research affiliation with Department of Physics and Astronomy,
University of Victoria (astrowww.phys.uvic.ca).
Programming affiliations with the FreeEOS equation-of-state implementation
for stellar interiors (freeeos.sf.net); PLplot scientific plotting software
package (plplot.org); the libLASi project (unifont.org/lasi); the Loads of
Linux Links project (loll.sf.net); and the Linux Brochure Project
(lbproject.sf.net).
__________________________
Linux-powered Science
__________________________
More information about the Discuss
mailing list