Possible bug (was Re: numpy, overflow, inf, ieee, and rich comparison)

Pete Forman gsez020 at kryten.bedford.waii.com
Wed Oct 11 09:13:59 EDT 2000


>>>>> "Martin" == Martin Luethi <luthi at vaw.baug.ethz.ch> writes:

    Martin> I just tried out these examples on Linux (SuSE 6.4 on
    Martin> PIII) and Solaris 5.7 (on Sparc architecture) and I get
    Martin> different behaviour with for the expressions. Both Python
    Martin> interpreters have been compiled with a nearly identical
    Martin> version of gcc

Beware.  The behaviour of math functions is dependent on more than the
compiler version.  On gcc there is a -ffast-math option which favours
speed over IEEE 754 compliance.  Other compilers have other such
options hidden away in the fine print of their man pages.  Often these
options are invoked implicitly by others such as -O5.  The math
library -lm is also a factor.

The other thing I'd be wary of is assuming that printf and friends are
handling your results properly on non-normal numbers.  I'd be tempted
to print out the underlying bits as well.  Use something like a union
of double and unsigned char[8].  I've a short C program that allows
you to play with those if anyone is interested.  See the link below.
-- 
Pete Forman                 -./\.- Disclaimer: This post is originated
Western Geophysical           -./\.-  by myself and does not represent
pete.forman at westgeo.com         -./\.-  the opinion of Baker Hughes or
http://www.crosswinds.net/~petef  -./\.-  its divisions.



More information about the Python-list mailing list