Package java.math
Provides classes for performing arbitrary-precision integer arithmetic (BigInteger
) and arbitrary-precision decimal arithmetic (BigDecimal
). BigInteger
is analogous to the primitive integer types except that it provides arbitrary precision, hence operations on BigInteger
s 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 a few other miscellaneous operations. BigDecimal
provides arbitrary-precision signed decimal numbers suitable for currency calculations and the like.
BigDecimal
gives the user complete control over rounding behavior, allowing the user to choose from a comprehensive set of eight rounding modes.
- Since:
- 1.1
Class | Description |
---|---|
BigDecimal | Immutable, arbitrary-precision signed decimal numbers. |
BigInteger | Immutable arbitrary-precision integers. |
MathContext | Immutable objects which encapsulate the context settings which describe certain rules for numerical operators, such as those implemented by the |
Enum | Description |
---|---|
RoundingMode | Specifies a rounding behavior for numerical operations capable of discarding precision. |
© 1993, 2020, Oracle and/or its affiliates. All rights reserved.
Documentation extracted from Debian's OpenJDK Development Kit package.
Licensed under the GNU General Public License, version 2, with the Classpath Exception.
Various third party code in OpenJDK is licensed under different licenses (see Debian package).
Java and OpenJDK are trademarks or registered trademarks of Oracle and/or its affiliates.
https://docs.oracle.com/en/java/javase/11/docs/api/java.base/java/math/package-summary.html