Java中float和double的包含范围是多少? [英] What is the inclusive range of float and double in Java?

查看:31
本文介绍了Java中float和double的包含范围是多少?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

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.

查看 DoubleMin_VALUEMAX_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屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆