[Numpy-discussion] Odd-looking long double on windows 32 bit

Matthew Brett matthew.brett at gmail.com
Sun Nov 13 02:35:53 EST 2011


Sorry for my continued confusion here.  This is numpy 1.6.1 on windows
XP 32 bit.

In [2]: np.finfo(np.float96).nmant
Out[2]: 52

In [3]: np.finfo(np.float96).nexp
Out[3]: 15

In [4]: np.finfo(np.float64).nmant
Out[4]: 52

In [5]: np.finfo(np.float64).nexp
Out[5]: 11

If there are 52 bits of precision, 2**53+1 should not be
representable, and sure enough:

In [6]: np.float96(2**53)+1
Out[6]: 9007199254740992.0

In [7]: np.float64(2**53)+1
Out[7]: 9007199254740992.0

If the nexp is right, the max should be higher for the float96 type:

In [9]: np.finfo(np.float64).max
Out[9]: 1.7976931348623157e+308

In [10]: np.finfo(np.float96).max
Out[10]: 1.#INF

I see that long double in C is 12 bytes wide, and double is the usual 8 bytes.

So - now I am not sure what this float96 is.  I was expecting 80 bit
extended precision, but it doesn't look right for that...

Does anyone know what representation this is?

Thanks a lot,


More information about the NumPy-Discussion mailing list