类 java.math.MathContext 的使用

  • Post author:
  • Post category:java



使用

MathContext

的软件包


java.math

提供用于执行任意精度整数算法 (BigInteger) 和任意精度小数算法 (BigDecimal) 的类。




java.math



MathContext

的使用
声明为

MathContext



java.math

中的字段

static

MathContext



MathContext.



DECIMAL128




一个

MathContext

对象,其精度设置与 IEEE 754R Decimal128 格式(即 34 个数字)匹配,舍入模式为


HALF_EVEN


,这是 IEEE 754R 的默认舍入模式。

static

MathContext



MathContext.



DECIMAL32




一个

MathContext

对象,其精度设置与 IEEE 754R Decimal32 格式(即 7 个数字)匹配,舍入模式为


HALF_EVEN


,这是 IEEE 754R 的默认舍入模式。

static

MathContext



MathContext.



DECIMAL64




一个

MathContext

对象,其精度设置与 IEEE 754R Decimal64 格式(即 16 个数字)匹配,舍入模式为


HALF_EVEN


,这是 IEEE 754R 的默认舍入模式。

static

MathContext</