开发者

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.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜