[Numpy-discussion] float96 on windows32 is float64?
Matthew Brett
matthew.brett at gmail.com
Fri Mar 16 00:10:03 EDT 2012
Hi,
Am I right in thinking that float96 on windows 32 bit is a float64
padded to 96 bits? If so, is it useful? Has anyone got a windows64
box to check float128 ?
Python 2.7.1 (r271:86832, Nov 27 2010, 18:30:46) [MSC v.1500 32 bit
(Intel)] on win32
Type "help", "copyright", "credits" or "license" for more information.
>>> import numpy as np
>>> np.__version__
'1.6.1'
>>> info = np.finfo(np.float96)
>>> print info
Machine parameters for float96
---------------------------------------------------------------------
precision= 15 resolution= 1e-15
machep= -52 eps= 2.22044604925e-16
negep = -53 epsneg= 1.11022302463e-16
minexp=-16382 tiny= 0.0
maxexp= 16384 max= 1.#INF
nexp = 15 min= -max
---------------------------------------------------------------------
>>> info.nmant
52
Confirming 52 (+1 implicit) significand digits
>>> np.float96(2**52)+1
4503599627370497.0
>>> np.float96(2**53)+1
9007199254740992.0
float96 claims 15 exponent digits (nexp above), but in fact it appears
to have 11, as does float64
>>> np.float64(2**1022) * 2
8.9884656743115795e+307
>>> np.float64(2**1022) * 4
__main__:1: RuntimeWarning: overflow encountered in double_scalars
inf
>>> np.float96(2**1022) * 2
8.9884656743115795e+307
>>> np.float96(2**1022) * 4
1.#INF
It does take up 12 bytes (96 bits)
>>> np.dtype(np.float96).itemsize
12
Thanks,
Matthew
More information about the NumPy-Discussion
mailing list