Is GMP broken? It can't be done!
When I call get_d() on a MPQ v开发者_StackOverflow中文版ariable in the GMP library, I only get at most six digits.
C++ is supposed to provide 8 bytes or ~15 digits for doubles. Why am I only getting six digits?
I found out why six digits was standard -
by default, when outputting doubles in C++ using cout, the precision is set to six significant figures. You can modify this precision by doing the following:
double bignumber = 12.32576158213;
cout << setprecision(10);
cout << bignumber << endl;
The output will be 12.32576158.
精彩评论