pickle and infinity

Grant Edwards grante at visi.com
Wed Nov 29 14:59:39 EST 2006


On 2006-11-29, Bart Ogryczak <B.Ogryczak at gmail.com> wrote:
>
> Fredrik Lundh wrote:
>> Bart Ogryczak wrote:
>>
>> > I´ve got this problem with pickle, it seems it doesn´t handle
>> > correctly infinite values (nor does Python return overflow/underflow
>> > error).
>>
>> Python 2.X relies on the C library to serialize floats, and, as you've
>> noticed, some C libraries can produce values that they themselves cannot
>> read.
>
> Actually I´d be very happy, if Python would throw FloatPointExeption,
> rather then allow infinite values.

I'd be very unhappy.  I use both NaNs and infinities in many
programs, so it needs to be selectable should that feature be
added.

> Haven´t got idea how to do it. fpectl would do the trick, but
> it´s not present nither on Solaris, nor on Windows platform.
> And I´d need it on both.

In my experience anything than needs to be portable and
involves NaN, inf, or denormals is rather painful.

-- 
Grant Edwards                   grante             Yow!  I wish I was a
                                  at               sex-starved manicurist
                               visi.com            found dead in the Bronx!!



More information about the Python-list mailing list