United StatesChange Country, Oracle Worldwide Web Sites Communities I am a... I want to...
JDK-4018937 : API: DecimalFormat formats BigDecimal incorrectly

Details
Type:
Bug
Submit Date:
1996-12-11
Status:
Resolved
Updated Date:
2004-09-27
Project Name:
JDK
Resolved Date:
2003-12-02
Component:
core-libs
OS:
solaris_2.5,windows_nt,generic,windows_95,windows_2000
Sub-Component:
java.text
CPU:
x86,sparc,unknown,generic
Priority:
P4
Resolution:
Fixed
Affected Versions:
1.0,1.1,1.1.3,1.1.5,1.1.6,1.2.0,1.2.1,1.2.2,1.3.0,5.0
Fixed Versions:
5.0 (b30)

Related Reports
Duplicate:
Duplicate:
Duplicate:
Duplicate:
Duplicate:

Sub Tasks

Description
Currently, the java.text package does not contain a derivation of the 
Format class for the Bignum class (e.g. BignumFormat) which allows
for the correct formatting and parsing of Bignum values.

The only way around this at present is to coerce Bignum's to doubles and
use the DecimalFormat class.  The resulting number though can result
in a loss of precision.

                                    

Comments
EVALUATION

This RFE will probably be satisfied by changing the existing
classes (DecimalFormat, DigitList) to accomodate BigInteger
and BigDecimal, not by adding a new subclasses.  I have such
versions in progress now.
alan.liu@eng 1998-10-29


In the current implementation, NumberFormat.format simply calls BigDecimal.doubleValue to convert to a double, thus losing precision.
See 4329840 and 4106664 for test cases.
norbert.lindenberg@Eng 2001-02-02
                                     
2001-02-02
PUBLIC COMMENTS

 Currently, the java.text package does not contain a derivation of the 
Format class for the Bignum class (e.g. BignumFormat) which allows
for the correct formatting and parsing of Bignum values.

The only way around this at present is to coerce Bignum's to doubles and
use the DecimalFormat class.  The resulting number though can result
in a loss of precision.
                                     
2004-09-28
CONVERTED DATA

BugTraq+ Release Management Values

COMMIT TO FIX:
tiger
tiger-beta

FIXED IN:
tiger-beta

INTEGRATED IN:
tiger-b30
tiger-beta


                                     
2004-09-28



Hardware and Software, Engineered to Work Together