[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 15:10:46 PDT 2007


On 2007-06-25 14:19-0700 Murray Strome wrote:

> I don't really know the answer to this one, but just as a guess, is it 
> possible that Python would automatically use a larger word size for 
> calculating these things (e.g. 64 bit or 128 bit floating point as opposed to 
> 32bit)? Might that be the difference?

That's an interesting question.

According to python documentation (Python Essential reference p. 23), python
uses native double precision (64-bit floating point), i.e., it is identical
to the C double type.  Fortran real*8 (for g77 and gfortran) is also
identical to the C double type.  Thus, you should expect to get the same
answers from g77/gfortran, gcc, and python for these test cases, but you
don't.

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