How I could find max two decimal precision vale that can be stored in float ?
From my understanding, In 32 bit float we have 24(23+1) for storing the number excluding exponent. is 2^24 is the max value we could store ?
Thanks in advance.
Sriraman
解决方案
2^24 is the largest integer you can store accurately. The largest two decimal places value you can store without loss of precision. 2^24/100.
Note: even 0.1 & 0.01 cannot be stored accurately but with rounding you can get this value without error. So taking the question literally, the largest value is 0.00. ;)
The largest value with two digits of precision is close to Float.MAX_VALUE, but I don't think that is what you mean.
博客探讨在Java里如何查找float能存储的最大两位小数精度值。提到32位float中24位用于存数,2^24是能准确存储的最大整数,最大无精度损失的两位小数是2^24/100,还指出0.1和0.01不能精确存储等内容。

被折叠的 条评论
为什么被折叠?



