numpy NaN, not surviving pickle/unpickle?

Scott David Daniels Scott.Daniels at Acm.Org
Mon Sep 14 17:05:27 CEST 2009


Steven D'Aprano wrote:
> On Sun, 13 Sep 2009 17:58:14 -0500, Robert Kern wrote:
> Exactly -- there are 2**53 distinct floats on most IEEE systems, the vast 
> majority of which might as well be "random". What's the point of caching 
> numbers like 2.5209481723210079? Chances are it will never come up again 
> in a calculation.

You are missing a few orders of magnitude here; there are approx. 2 ** 64
distinct floats.  2 ** 53 is the mantissa of regular floats.  There are
2**52 floats X where 1.0 <= X < 2.0.
The number of "normal" floats is 2 ** 64 - 2 ** 52 + 1.
The number including denormals and -0.0 is 2 ** 64 - 2 ** 53.

There are approx. 2 ** 53 NaNs (half with the sign bit on).

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



More information about the Python-list mailing list