Java中Float的最大值? [英] Maximum value for Float in Java?
本文介绍了Java中Float的最大值?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
以下问题表示Double是 -Double.MAX_VALUE
。这对于Float也是如此(即, -Float.MAX_VALUE
)?
-Float.MAX_VALUE
是最大量级的负数。 float
s的表示方式与 double
s相同,只是存储空间的一半(以及伴随的精度损失。)由于IEEE 754中的符号由一位表示,所以翻转该位不会改变剩余位所能达到的整体幅度。The following question indicates that the minimum value of a Double is -Double.MAX_VALUE
. Is this also true for Float (i.e., -Float.MAX_VALUE
)?
解决方案
Yes, -Float.MAX_VALUE
is the negative number with largest magnitude. float
s are represented the same way as double
s, just with half the storage space (and the accompanying loss of precision.) Since signs in IEEE 754 are represented by a single bit, flipping that bit doesn't change the overall magnitude attainable by the remaining bits.
这篇关于Java中Float的最大值?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文