JSRs: Java Specification Requests
JSR 13: Decimal Arithmetic Enhancement
JCP version in use: 2.1
Java Specification Participation Agreement version in use: 1.0
This primarily adds floating point arithmetic to the BigDecimal class, allowing the use of decimal numbers for general-purpose arithmetic without the problems resulting from conversions to and from another type.
Please direct comments on this JSR to the Spec Lead(s)
Updates to the original Java Specification Request (JSR)
The following updates have been made to the original JSR:
Maintenance Lead: Oracle America, Inc.
Contact: Joe Darcy
E-mail address: joe.darcy
Telephone: +1 408 276 7053
Original Java Specification Request (JSR)
Identification | Request | Contributions
Original Summary: The proposed enhancements to the BigDecimal class primarily add floating point arithmetic to the existing class, allowing the use of decimal numbers for general-purpose arithmetic (especially financial and user-centric applications) without the overheads and potential errors resulting from conversions to and from another type.
Section 1: Identification
This JSR is being submitted by the International Business Machines Corporation (IBM).
Primary contact: :
This JSR has been formally endorsed by:
Section 2: Request
Target Java Platform: All platforms which include the package java.math.
Need that the work addresses: The proposed enhancements to the BigDecimal class primarily add floating point arithmetic to the existing class, allowing the use of decimal numbers for general-purpose arithmetic (especially financial and user-centric applications) without the overheads and potential errors resulting from conversions to and from another type. In addition, safe conversion methods are added to protect programmers from inadvertent data loss.
Why the existing specification does not meet the need: The current BigDecimal class lacks several operations required for common calculations, and the numbers it can manipulate are in practice limited to those which can be represented conveniently as 'plain' numbers, with no exponent. The limitations are severe:
Specification to be developed: We propose addressing the primary requirements by adding support for decimal floating point arithmetic to the BigDecimal class. This can be achieved without altering the existing behavior of the BigDecimal class by simply adding an optional context parameter to the existing operator methods. We also propose adding the missing operator methods, and a small number of improved constructors and conversion methods. The expert group may also wish to consider adding additional mathematical functions, equivalent to those in the class java.lang.Math.
Underlying technologies: It is proposed that the decimal arithmetic algorithms implemented by the augmented class be those defined in the ANSI standard X3.274-1996 (Programming Language REXX, 1996) which provide the necessary function in a form which is compatible with existing BigDecimal numbers.
Proposed package name: It is proposed that the existing java.math package be enhanced.
Possible platform dependencies: None.
Security implications: None. The existing characteristics of the BigDecimal class are preserved.
Internationalization and localization dependencies: It is expected that the expert group will define suitable additions to the java.text.DecimalFormat class to support the enhanced capabilities of the BigDecimal class.
Risk assessment: Apart from the DecimalFormat class just described, the proposed enhancements have no interdependencies with other classes. If the enhancements are not made, the Java platform will continue to be inadequate for commercial, financial, and user-centric data processing. A potential Reference Implementation (RI) and Compatibility Test Suite (CTS) already exist.
Existing specifications that might be deprecated: We propose deprecating the BigDecimal(double) constructor, which currently gives results that are different to the Double.toString() method.
Existing specifications that might need revision: The java.math.BigDecimal class will need revision. The java.text.DecimalFormat class would benefit from revision. A very small java.math.MathContext class is added.
Section 3: Contributions
IBM has a complete implementation of the proposed enhancements to the BigDecimal class, along with testcases that test compatibility with both the existing JCK and ANSI X3.274. This implementation could form the basis for the Reference Implementation.
The most recent documentation and binaries (.class files) for the IBM implementation, including background material, may be found at http://www2.hursley.ibm.com/decimal.
The underlying technology, including algorithms for the arithmetic, is published in: American National Standard for Information Technology -- Programming Language REXX, X3.274-1996, American National Standards Institute, New York, 1996. Additional details and any errata are available at the Rexx Language Association web site.