How do I avoid scientific notation for large numbers?
So, I'm thinking that what you really want is just the ability to print it without scientific notation. If you're using printf
, what you want is:
printf( "%f1000.0", value );
// note that 1000 is way larger than need be,
// I'm just too lazy to count the digits
With cout
, try something like:
cout.setf(ios::fixed);
cout << setprecision(0) << value;
If you want to print it as a power of two (2^1000 vs 10715...), you're on your own.
There is a practical limit to how large a number that can be directly manipulated in machine registers can be. if you are using double precision floats there are a total of 64 bits, some of which are devoted to the mantissa, some to the exponent, and 1 to the sign bit.
2^1000 needs a 1001 bit integer to be represented without losing precision. In order to work with numbers like that you will need to use a library that has big number support, such as GNU MP.