[Numpy-discussion] np.finfo().maxexp confusing
Matthew Brett
matthew.brett@gmail....
Tue Oct 11 13:39:48 CDT 2011
Hi,
I realize it is probably too late to do anything about this, but:
In [72]: info = np.finfo(np.float32)
In [73]: info.minexp
Out[73]: -126
In [74]: info.maxexp
Out[74]: 128
minexp is correct, in that 2**(-126) is the minimum value for the
exponent part of float32. But maxexp is not correct, because 2**(127)
is the maximum value for the float32 exponent part:
http://en.wikipedia.org/wiki/Single_precision_floating-point_format
There is the same maxexp+1 feature for the other float types.
Is this a sufficiently quiet corner of the API that it might be
changed in the future with suitable warnings?
Best,
Matthew
More information about the NumPy-Discussion
mailing list