站内搜索: 请输入搜索关键词
当前页面: 在线文档首页 > JDK 5 Documentation v6.0, Java 2 SDK 英文文档

Uses of Class java.math.MathContext (Java Platform SE 6) - JDK 5 Documentation v6.0, Java 2 SDK 英文文档


Java™ Platform
Standard Ed. 6

Uses of Class
java.math.MathContext

Packages that use MathContext
java.math Provides classes for performing arbitrary-precision integer arithmetic (BigInteger) and arbitrary-precision decimal arithmetic (BigDecimal). 
 

Uses of MathContext in java.math
 

Fields in java.math declared as MathContext
static MathContext MathContext.DECIMAL128
          A MathContext object with a precision setting matching the IEEE 754R Decimal128 format, 34 digits, and a rounding mode of HALF_EVEN, the IEEE 754R default.
static MathContext MathContext.DECIMAL32
          A MathContext object with a precision setting matching the IEEE 754R Decimal32 format, 7 digits, and a rounding mode of HALF_EVEN, the IEEE 754R default.
static MathContext MathContext.DECIMAL64
          A MathContext object with a precision setting matching the IEEE 754R Decimal64 format, 16 digits, and a rounding mode of HALF_EVEN, the IEEE 754R default.
static MathContext MathContext.UNLIMITED
          A MathContext object whose settings have the values required for unlimited precision arithmetic.
 

Methods in java.math with parameters of type MathContext
 BigDecimal BigDecimal.abs(MathContext mc)
          Returns a BigDecimal whose value is the absolute value of this BigDecimal, with rounding according to the context settings.
 BigDecimal BigDecimal.add(BigDecimal augend, MathContext mc)
          Returns a BigDecimal whose value is (this + augend), with rounding according to the context settings.
 BigDecimal BigDecimal.divide(BigDecimal divisor, MathContext mc)
          Returns a BigDecimal whose value is (this / divisor), with rounding according to the context settings.
 BigDecimal[] BigDecimal.divideAndRemainder(BigDecimal divisor, MathContext mc)
          Returns a two-element BigDecimal array containing the result of divideToIntegralValue followed by the result of remainder on the two operands calculated with rounding according to the context settings.
 BigDecimal BigDecimal.divideToIntegralValue(BigDecimal divisor, MathContext mc)
          Returns a BigDecimal whose value is the integer part of (this / divisor).
 BigDecimal BigDecimal.multiply(BigDecimal multiplicand, MathContext mc)
          Returns a BigDecimal whose value is (this × multiplicand), with rounding according to the context settings.
 BigDecimal BigDecimal.negate(MathContext mc)
          Returns a BigDecimal whose value is (-this), with rounding according to the context settings.
 BigDecimal BigDecimal.plus(MathContext mc)
          Returns a BigDecimal whose value is (+this), with rounding according to the context settings.
 BigDecimal BigDecimal.pow(int n, MathContext mc)
          Returns a BigDecimal whose value is (thisn).
 BigDecimal BigDecimal.remainder(BigDecimal divisor, MathContext mc)
          Returns a BigDecimal whose value is (this % divisor), with rounding according to the context settings.
 BigDecimal BigDecimal.round(MathContext mc)
          Returns a BigDecimal rounded according to the MathContext settings.
 BigDecimal BigDecimal.subtract(BigDecimal subtrahend, MathContext mc)
          Returns a BigDecimal whose value is (this - subtrahend), with rounding according to the context settings.
 

Constructors in java.math with parameters of type MathContext
BigDecimal(BigInteger unscaledVal, int scale, MathContext mc)
          Translates a BigInteger unscaled value and an int scale into a BigDecimal, with rounding according to the context settings.
BigDecimal(BigInteger val, MathContext mc)
          Translates a BigInteger into a BigDecimal rounding according to the context settings.
BigDecimal(char[] in, int offset, int len, MathContext mc)
          Translates a character array representation of a BigDecimal into a BigDecimal, accepting the same sequence of characters as the BigDecimal.BigDecimal(String) constructor, while allowing a sub-array to be specified and with rounding according to the context settings.
BigDecimal(char[] in, MathContext mc)
          Translates a character array representation of a BigDecimal into a BigDecimal, accepting the same sequence of characters as the BigDecimal.BigDecimal(String) constructor and with rounding according to the context settings.
BigDecimal(double val, MathContext mc)
          Translates a double into a BigDecimal, with rounding according to the context settings.
BigDecimal(int val, MathContext mc)
          Translates an int into a BigDecimal, with rounding according to the context settings.
BigDecimal(long val, MathContext mc)
          Translates a long into a BigDecimal, with rounding according to the context settings.
BigDecimal(String val, MathContext mc)
          Translates the string representation of a BigDecimal into a BigDecimal, accepting the same strings as the BigDecimal.BigDecimal(String) constructor, with rounding according to the context settings.
 


Java™ Platform
Standard Ed. 6

Submit a bug or feature
For further API reference and developer documentation, see Java SE Developer Documentation. That documentation contains more detailed, developer-targeted descriptions, with conceptual overviews, definitions of terms, workarounds, and working code examples.

Copyright 2006 Sun Microsystems, Inc. All rights reserved. Use is subject to license terms. Also see the documentation redistribution policy.