Java中float和double的包含范围是多少? [英] What is the inclusive range of float and double in Java?
问题描述
Java 中 float 和 double 的包含范围是多少?
What is the inclusive range of float and double in Java?
为什么不建议在精度至关重要的任何地方使用 float 或 double ?
Why are you not recommended to use float or double for anything where precision is critical?
推荐答案
Java 的 Double
类的成员包含该类型的最小值和最大值.
Java's Double
class has members containing the Min and Max value for the type.
2^-1074 <= x <= (2-2^-52)·2^1023 // where x is the double.
查看 Double
的 Min_VALUE
和 MAX_VALUE
静态最终成员.
Check out the Min_VALUE
and MAX_VALUE
static final members of Double
.
(一些)人们会建议不要在精度和精度至关重要的事情上使用浮点类型,因为舍入误差可能会以可测量的(小)量影响计算.
(some)People will suggest against using floating point types for things where accuracy and precision are critical because rounding errors can throw off calculations by measurable (small) amounts.
这篇关于Java中float和double的包含范围是多少?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!