[Numpy-discussion] Re: Numpy-discussion digest, Vol 1 #112 - 8 msgs

Greg Kochanski gpk at bell-labs.com
Thu Oct 12 10:01:19 CDT 2000


Python has *got* to ignore underflow exceptions.
Otherwise, virtually any numeric calculation that
subtracts numbers will fail for no good reason.

Worse, it will fail in a very sporadic, data-dependent
manner.   With double precision numbers, the failures will
be rare, but anyone doing computations with floats will
see unwanted exceptions with noticeable frequency.

I once did a numeric calculation (a SVD classifier)
on a system with IEEE-754 underflow exceptions turned on,
and I lost a good square inch of hair and a solid week
of life because of it.    At one point, the numbers
were converted from doubles to floats, and about 1 in
every 10,000,000 of the numbers were too small to represent
as a float.

So, in about 1 in ten runs (an hour each), the code
would crash for no obvious reason.  It was a debugging
nightmare.  If python catches underflows, I'm going
back to FORTRAN.



On less crucial topics, I'm strongly in favor of
preserving NaN and Inf.     If I want my code to crash
when some computation goes awry, I'll use assert,
and crash it myself.

Any serious numeric code should be loaded with assertions
(any code at all, in fact).   Asking the interpreter
to do it for you is a crude and blunt instrument.


If I may ask, what kind of platforms are there where
people do math where the hardware *won't* support IEEE-754?



More information about the Numpy-discussion mailing list