Jump to content

Java.math

From Wikipedia, the free encyclopedia
This is an old revision of this page, as edited by Samxli (talk | contribs) at 08:45, 1 May 2005. The present address (URL) is a permanent link to this revision, which may differ significantly from the current revision.
(diff) ← Previous revision | Latest revision (diff) | Newer revision → (diff)


java.math is a package in the Java programming language, containing the classes for performing arbitrary-precision integer arithmetic and arbitrary-precision decimal arithmetic.

To use the objects within this package in your Java code be sure to include the statement:

import java.math.*;


Package Content

Classes

  • BigDecimal - provides arbitrary-precision signed decimal numbers. BigDecimal gives the user control over rounding behavior through RoundingMode.
  • BigInteger - provides arbitrary-precision integers. Operations on BigIntegers do not overflow or lose precision. In addition to standard arithmetic operations, BigInteger provides modular arithmetic, GCD calculation, primality testing, prime generation, bit manipulation, and other miscellaneous operations.
  • MathContext - encapsulate the context settings which describe certain rules for numerical operators.

Enums

  • RoundingMode - provides eight rounding behaviors.