pickle broken: can't handle NaN or Infinity under win32

Grant Edwards grante at visi.com
Wed Jun 22 15:18:44 EDT 2005


On 2005-06-22, Scott David Daniels <Scott.Daniels at Acm.Org> wrote:

>> I'm working on it.  I should have said it's trivial if you have
>> access to the platforms to be supported.  I've tested a fix
>> that supports pickle streams generated under Win32 and glibc.
>> That's using the "native" string representation of a NaN or
>> Inf.
> Several issues:

> (1) The number of distinct NaNs varies among platforms.

According to the IEEE standard, there are exactly two:
signalling and quiet, and on platforms that don't impliment
floating point exceptions (probably in excess of 99.9% of
python installations), the difference between the two is moot.

>     There are quiet and signaling NaNs, negative 0,

Negative 0 isn't a NaN, it's just negative 0.
 
>     the NaN that Windows VC++ calls "Indeterminate," and so
>     on.

That's just Microsoft's way of spelling "signalling NaN."

> (2) There is no standard-conforming way to create these values.

What standard are you looking at?  My copy of the IEEE 754
standard is pretty clear.

> (3) There is no standard-conforming way to detect these
> values.

The bit patterns are defined by the IEEE 754 standard.  If
there are Python-hosting platoforms that don't use IEEE 754 as
the floating point representation, then that can be dealt with.

Python has _tons_ of platform-specific code in it.  

Why all of a sudden is it taboo for Python to impliment
something that's not universally portable and defined in a
standard?  Where's the standard defining Python?

-- 
Grant Edwards                   grante             Yow!  ... A housewife
                                  at               is wearing a polypyrene
                               visi.com            jumpsuit!!



More information about the Python-list mailing list