Numerics, NaNs, IEEE 754 and C99

Scott David Daniels scott.daniels at
Wed Jun 14 18:15:30 CEST 2006

Grant Edwards wrote:

> While you're at it, the pickle modules need to be fixed so they
> support NaN and Inf. ;)
The NaN problem is portability -- NaN values are not standard, and
pretending they are won't help.  There are many possible NaNs, several
of which have desirable behaviors, and different processors (and 
Floating Point settings) choose different bit representations for
those NaNs.  There are at least: Inf, -Inf, NaN, Ind (Indeterminant).

Being able to pickle some of these will produce values that "don't
behave right" on a different machine.  Up until now, I think you can
send a pickle of a data structure and unpickle it on a different
processor to get equivalent data.

--Scott David Daniels
scott.daniels at

More information about the Python-list mailing list