[SciPy-dev] Nan's

Travis Oliphant oliphant at ee.byu.edu
Fri Nov 1 18:32:03 CST 2002

Hi all.

I think the issues with nans can be resolved.

Matlab uses them.  Octave uses them.

It seems that scipy should be able to handle them properly on the same
platforms where these codes work.

IEEE has a well-defined standard for them, also that most compilers can
support if configured correctly.   The problem is when you use a
compiler in a configuration where it intentionally breaks IEEE standards.

For example,

gcc CANNOT use the -ffast-math flag on a file where nan comparisons will
be taking place.

So, removing -ffast-umath from a gcc compiled file suddenly makes nan
comparisons work correctly as defined by the IEEE

I'm not as good at figuring out the distutils stuff as others on this
list, so could somebody show me how to make sure that the flag -ffast-math
is not turned on while compiling fastumathmodule.c (and some of the
cephes librarys files as well).

You can't expect the standard to work, when you use a compiler in a way to
intentionally break it.


Travis Oliphant
Assistant Professor
459 CB
Electrical and Computer Engineering
Brigham Young University
Provo, UT 84602
Tel: (801) 422-3108
oliphant.travis at ieee.org

More information about the Scipy-dev mailing list