what exactly precision of 15 digits mean for float data type?

眉间皱痕 提交于 2019-12-25 15:54:22

问题


As per the http://msdn.microsoft.com/en-us/library/ms173773.aspx

float is approx. data type.

But also in the same article it is being mentioned that float has precision of 15 digits.

What exactly it mean by Precision of 15 digits ?


回答1:


It means that the first 15 digits are approximately correct. Thanks to IEEE 754 there are many numbers that can't be exactly represented, but you can be sure that the first 15 digits are very close.




回答2:


Your numbers are exact with a precision of 15 digits. That means if you calculate something and store the outcome as a float, you can be sure the first 15 digits are the right result. After that they might (and usually are) not.



来源:https://stackoverflow.com/questions/6522183/what-exactly-precision-of-15-digits-mean-for-float-data-type

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!