java中显示float的最大值,Java float中的最大值可以以两位数的精度(2位精度)存储?...

博客探讨在Java里如何查找float能存储的最大两位小数精度值。提到32位float中24位用于存数,2^24是能准确存储的最大整数,最大无精度损失的两位小数是2^24/100,还指出0.1和0.01不能精确存储等内容。

摘要生成于 C知道 ,由 DeepSeek-R1 满血版支持, 前往体验 >

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.

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值