Get Time
Search | Watch Thread  |  My Post History  |  My Watches  |  User Settings
View: Flat (newest first)  | Threaded  | Tree
Previous Thread  |  Next Thread
sizeof(long double) | Reply
The article mentions that g++ on x86 uses and 80 bit long double. But printing sizeof(long double) in the tc arena prints 12 instead of 10. So whats the size of a long double?
Re: sizeof(long double) (response to post by gautam2roy) | Reply
If you ask Google it will comment that the compilers like to align the 10 byte doubles in 12 bytes memory.

If you are actually interested in the precision of a long double, use numeric_limits.
#include <limits>
numeric_limits<long double> l;
cout << sizeof(long double) << ' ' << l.digits << ' ' << l.max_exponent;
prints 12 64 16384 for me, so it is like the "80 bit long double" you'd expect.