Is there a native c++ variable type that's "bigger" than a double?
float is 7
double is 15 (of course depending on the compiler)
Is there anything bigger that's native, or even non-native?
Type long double is a floating point type that is larger than or equal to type double . Microsoft-specific: The representation of long double and double is identical. However, long double and double are treated as distinct types by the compiler.
C++ has long double , but there is no guarantee that it's any more precise than a plain double . On an x86 platform, usually double is 64 bits, and long double is either 64 or 80 bits (which gives you 19 significant figures, if I remember right).
In an article on MSDN, it states that the double data type has a range of "-1.79769313486232e308 .. 1.79769313486232e308". Whereas the long data type only has a range of "-9,223,372,036,854,775,808 .. 9,223,372,036,854,775,807".
A float has 7 decimal digits of precision and occupies 32 bits . A double is a 64-bit IEEE 754 double-precision floating-point number. 1 bit for the sign, 11 bits for the exponent, and 52 bits for the value. A double has 15 decimal digits of precision and occupies a total of 64 bits .
C++ has long double
, but there is no guarantee that it's any more precise than a plain double
. On an x86 platform, usually double
is 64 bits, and long double
is either 64 or 80 bits (which gives you 19 significant figures, if I remember right).
Your mileage may vary, especially if you're not on x86.
A long double typically only uses 10 bytes, but due to alignment may actually take up 12 or 16 (depending on the compiler and options) bytes in a structure.
The 10 byte long double provides a 64-bit mantissa; this is very convenient for when you want to store 64 bit integers in floating point without loss of precision.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With