numpy.longdouble refers to any type that your C compiler calls long double . This is currently the only extended floating point type supported by numpy.
On x86-32 and x86-64, this is an 80-bit floating point type . On more exotic systems, this may be something else (IIRC on Sparc is the actual 128-bit IEEE float, and on PPC it is double-double ). (It may also depend on which OS and compiler you are using - for example, MSVC on Windows does not support any extended precision at all.)
Numpy also exports some name, such as numpy.float96 or numpy.float128 . Which of these names is exported depends on your platform / compiler, but everything you get always refers to the same base type as longdouble . In addition, these names are very misleading. They do not specify the 96- or 128-bit IEEE floating point format. Instead, they indicate the number of alignment bits used by the base type long double . So, for example, on x86-32, long double is 80 bits, but gets up to 96 bits to support 32-bit alignment, and numpy calls this float96 . On x86-64, the long double again the same 80-bit type, but now it is populated up to 128 bits to support 64-bit alignment, and numpy calls it float128 . There is no extra accuracy, just an extra addition.
Recommendation: ignore float96 / float128 , just use numpy.longdouble . Or even better, stick with doubles if you have no truly compelling reason. They will be faster, more portable, etc.
Nathaniel J. Smith Jun 10 '13 at 12:33
source share