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 tha
C++ has long double, but it's still quite limited. For good time try GNU's gmp library. You can set up numbers as big as you like, and it's quite fun and hackishly when you use gmp_add instead of a normal +. I'm sure there's a C++ wrapper somewhere.
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.
There are also some various bigfloat/bigint libraries around for C++ that allow arbitrary precision math. There's this library on Microsoft Codeplex, but Googling will find you plenty of others.
Boost 1.53 or higher has multiprecision.
http://www.boost.org/doc/libs/1_54_0/libs/multiprecision/doc/html/index.html
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.
long double, but it generally is still 15 places of precision too.