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

Grant Edwards grante at visi.com
Wed Jun 22 22:51:20 EDT 2005


On 2005-06-22, Scott David Daniels <Scott.Daniels at Acm.Org> wrote:
> Grant Edwards wrote:
>> On 2005-06-22, Scott David Daniels <Scott.Daniels at Acm.Org> wrote:
>>>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.
>
> But it does not specify the representation of such NaNs.

Yes, it does.  It specifies it exactly: certain bits are ones,
certain other bits are zeros.  I don't know how much more exactly
the representation can be defined.

>> The bit patterns are defined by the IEEE 754 standard.

> Perhaps this is right and I misunderstand the standard, but my
> understanding is that the full bit pattern is not, in fact,
> defined.

The represntation of NaNs, infinities, normalized numbers and
denormal numbers are all completely defined by the standard.

>> If there are Python-hosting platoforms that don't use IEEE 754 as
>> the floating point representation, then that can be dealt with.

> There are.

That's where it gets nasty. 

>> Python has _tons_ of platform-specific code in it.  

> But the _tons_ are written in C89 C.

True.

> It is not taboo.  I am trying to explain why it is not a
> trivial task, but a substantial effort.

It's trivial for platforms that obey the IEEE 754 standard.

> If you are willing to perform the substantial effort, good on
> you, and I'll help. If you simply want to implement on the two
> platforms you use, and want everyone else to implement the
> interface you choose, that seems to me an unreasonable
> request.

I would think that implimenenting things according to the IEEE
standard and letting non-standard platforms figure out what to
do for themselves would seem a reasonable approach.

-- 
Grant Edwards                   grante             Yow!  Now I understand the
                                  at               meaning of "THE MOD SQUAD"!
                               visi.com            



More information about the Python-list mailing list