Numerics, NaNs, IEEE 754 and C99
Grant Edwards
grante at visi.com
Wed Jun 14 12:22:31 EDT 2006
On 2006-06-14, Scott David Daniels <scott.daniels at acm.org> wrote:
> 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,
My copy of IEEE 754 defines them quite precisely. :)
> 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).
I don't think +Inf and -Inf aren't NaNs (in IEEE 754
terminology). I think Pickle ought to handle them as well.
> Being able to pickle some of these will produce values that
> "don't behave right" on a different machine.
The values "don't behave right" now. Having them "behave
right" on 99.9% of the hosts in the world would be a vast
improvement.
> 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.
No, you can't. Nan, Inf, and Ind floating point values don't
work.
--
Grant Edwards grante Yow! Yow! STYROFOAM...
at
visi.com
More information about the Python-list
mailing list