numpy.longdouble
refers to whatever type your C compiler calls long double
. Currently, this is the only extended precision floating point type that numpy supports.
On x86-32 and x86-64, this is an 80-bit floating point type. On more exotic systems it may be something else (IIRC on Sparc it's an actual 128-bit IEEE float, and on PPC it's double-double). (It also may depend on what OS and compiler you're using -- e.g. MSVC on Windows doesn't support any kind of extended precision at all.)
Numpy will also export some name like numpy.float96
or numpy.float128
. Which of these names is exported depends on your platform/compiler, but whatever you get always refers to the same underlying type as longdouble
. Also, these names are highly misleading. They do not indicate a 96- or 128-bit IEEE floating point format. Instead, they indicate the number of bits of alignment used by the underlying long double
type. So e.g. on x86-32, long double
is 80 bits, but gets padded up to 96 bits to maintain 32-bit alignment, and numpy calls this float96
. On x86-64, long double
is again the identical 80 bit type, but now it gets padded up to 128 bits to maintain 64-bit alignment, and numpy calls this float128
. There's no extra precision, just extra padding.
Recommendation: ignore the float96
/float128
names, just use numpy.longdouble
. Or better yet stick to doubles unless you have a truly compelling reason. They'll be faster, more portable, etc.