Jump to content

Java.math: Difference between revisions

From Wikipedia, the free encyclopedia
Content deleted Content added
m lowercase title template, category
added links to API Javadocs
Line 3: Line 3:
'''<code>java.math</code>''' is a [[packages in Java|package]] in the [[Java programming language]], containing the [[Class (computer science)|classes]] for performing arbitrary-precision integer arithmetic and arbitrary-precision decimal arithmetic.
'''<code>java.math</code>''' is a [[packages in Java|package]] in the [[Java programming language]], containing the [[Class (computer science)|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:
To use the objects within this package in your Java code it is convenient to include the statement:
import java.math.*;
import java.math.*;


Line 9: Line 9:
===Classes===
===Classes===


*<code>BigDecimal</code> - provides arbitrary-precision signed decimal numbers. BigDecimal gives the user control over rounding behavior through <code>RoundingMode</code>.
*{{Javadoc:SE|java/math|BigDecimal}} &ndash; provides arbitrary-precision signed decimal numbers. BigDecimal gives the user control over rounding behavior through <code>RoundingMode</code>.
*<code>BigInteger</code> - provides arbitrary-precision integers. Operations on BigIntegers do not [[Arithmetic_overflow | overflow]] or lose precision. In addition to standard arithmetic operations, it provides [[modular arithmetic]], [[Greatest_common_divisor | GCD]] calculation, [[primality testing]], [[prime number | prime]] generation, [[bit]] manipulation, and other miscellaneous operations.
*{{Javadoc:SE|java/math|BigInteger}} &ndash; provides arbitrary-precision integers. Operations on BigIntegers do not [[Arithmetic_overflow | overflow]] or lose precision. In addition to standard arithmetic operations, it provides [[modular arithmetic]], [[Greatest_common_divisor | GCD]] calculation, [[primality testing]], [[prime number | prime]] generation, [[bit]] manipulation, and other miscellaneous operations.
*<code>MathContext</code> - encapsulate the context settings which describe certain rules for numerical operators.
*{{Javadoc:SE|java/math|MathContext}} &ndash; encapsulate the context settings which describe certain rules for numerical operators.


===Enums===
===Enums===


*<code>RoundingMode</code> - provides eight rounding behaviors.
*{{Javadoc:SE|java/math|RoundingMode}} &ndash; provides eight rounding behaviors.


==External links==
==External links==
* {{Javadoc:SE|package=java.math|java/math}} (API [[Javadoc]] documentation)
* [http://java.sun.com/j2se/1.5.0/docs/api/java/math/package-tree.html Class hierarchy on java.sun.com]


[[Category:Java programming language]]
[[Category:Java programming language]]

Revision as of 21:12, 19 January 2006


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 it is convenient 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, it 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