Computer systems can provide an arithmetic that gives the results that
people expect, instead of the results that binary floating point
calculations give (see the sidebar on the right for an example).
This is not available in Java today, so a decimal floating point
arithmetic is needed – one which gives the same results as the
arithmetic that people learn at school (see the
Decimal
Arithmetic FAQ for more details).
This site describes an enhanced BigDecimal class (com.ibm.math.BigDecimal) for Java, which is the basis for a proposed enhancement to java.math.BigDecimal. Please see the Java Specification Request (JSR) for details of the proposal. This JSR was completed in 2004; you can find changes from this design in the Decimal Arithmetic Enhancement Public Review Draft; the revised BigDecimal class and the new MathContext class were shipped in Java 5. The com.ibm.math.BigDecimal class and its supporting class, MathContext, are fully implemented and are available below in both Java and NetRexx. They are also included with IBM's Java developer kits as of version 1.1.8. The new class extends the existing class with the floating point arithmetic from ANSI X3.274, which does arithmetic the way people do. This makes it especially easy to add humanoriented arithmetic to your applications. Here, you'll find:


Copyright © IBM Corporation 1998, 2002. All rights reserved.
Java is a trademark of Sun Microsystems Inc. 