can somebody explain how the "long double" is stored in memory. what is the decimal range it can store? I would like to know abt the 128 bit long double not the extended 80 bit double.
Thanks in advance
That one describes how it is stored, it's ranges, and some examples. Finishing with the first article, I get the impression that long double is very much system dependent.
I can't tell you for 128bit long doubles, because my compiler has 80bit long doubles, but you should be able to check for yourself.
Just include <cfloat>, and then you'll have access to LDBL_MIN and LDBL_MAX (minimum and maximum value you can store in a long double). Additionally, you also have access to LDBL_MIN_10_EXP and LDBL_MAX_10_EXP , the minimum and maximum values for the exponent.
Finally, there's also LDBL_MANT_DIG, which is how many bits are used to store the significant.
long double is platform and compiler dependent. That is you are unlikely to find them on a platform what has no hardware support for larger precision floating point and even if there is hardware support for them you don't always get them for every compiler.
MSVC is a good example I believe it does not support and precision beyond double even on the Intel platforms that I believe support 80 bit floating point operations and this precision can be used through gcc.
Note that the type long double is always valid but that on platforms without support for higher precision floating point operations it will default to the same precision as a double.
Comment