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

Scott David Daniels Scott.Daniels at Acm.Org
Wed Jun 22 18:44:43 EDT 2005


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.

> Negative 0 isn't a NaN, it's just negative 0.
Right, but it is hard to construct in standard C.

>>(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.
I was talking about the C89 standard.  In the absence of a C
standard way to create, manipulate, and test for these values,
you must implement and test platform-by-platform.

> 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.

> 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.

> Python has _tons_ of platform-specific code in it.  
But the _tons_ are written in C89 C.

> 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?
It is not taboo.  I am trying to explain why it is not a
trivial task, but a substantial effort.  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.

--Scott David Daniels
Scott.Daniels at Acm.Org



More information about the Python-list mailing list