0

I have this question because of the previous one. There I had a value 25.3999996185302734375 which was shown as 25.399999618530273 (without last 4 digits) in both Visual Studio 2010, Eclipse CDT, and gdb (just "print 25.3999996185302734375" in gdb and it will show 25.399999618530273).

Now, in gdb (and thus Eclipse CDT) I can issue

 printf "%.20f\n", var

to view the value with more digits.

How do I do the same in Visual Studio - i.e., how do I change the precision of the inspected floating-point values?

I'm also curious if there's a way to change the default precision in both Visual Studio and Eclipse/gdb, because manually printing values is not that convenient.

4

1 回答 1

0

至于获得更多数字,你就不走运了。你不会从 Visual Studio 中得到超过 17 位数字(以及许多其他的编程环境)。使用 gcc 或任何基于它的东西,您可以获得任意数量的数字。

您可以查看我的文章Print Precision of Dyadic Fractions Varies by Language了解详细信息。

于 2013-03-15T13:07:09.600 回答