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.
This site introduces 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 for details of the proposal. The new BigDecimal class (and its supporting class, MathContext) is fully implemented and is available below, and is 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 human-oriented arithmetic to your applications. Attention has been paid to performance; the new class is typically 4-5 times faster than the Java 2 java.math.BigDecimal for common operations on 9-digit numbers, and up to 23 times faster for constructing BigDecimal objects. Here, you'll find:
Related links: |
|
Copyright © IBM Corporation 1998, 2000. All rights reserved.
Java is a trademark of Sun Microsystems Inc. |
![]() |
[
IBM home page |
Search |
Contact IBM |
Help |
Legal |
Privacy
]