JDK-4018937 : API: DecimalFormat formats BigDecimal incorrectly
  • Type: Bug
  • Status: Resolved
  • Resolution: Fixed
  • Component: core-libs
  • Sub-Component: java.text
  • Priority: P4
  • Affected Version:
    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 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
  • OS:
    generic,solaris_2.5,windows_95,windows_nt,windows_2000 generic,solaris_2.5,windows_95,windows_nt,windows_2000
  • CPU: generic,unknown,x86,sparc
  • Submit Date: 1996-12-11
  • Updated Date: 2017-05-16
  • Resolved Date: 2003-12-02
The Version table provides details related to the release that this issue/RFE will be addressed.

Unresolved : Release in which this issue/RFE will be addressed.
Resolved: Release in which this issue/RFE has been resolved.
Fixed : Release in which this issue/RFE has been fixed. The release containing this fix may be available for download as an Early Access Release or a General Availabitlity Release.

To download the current JDK release, click here.
Other
5.0 b30Resolved
Related Reports
Duplicate :  
Duplicate :  
Duplicate :  
Duplicate :  
Duplicate :  
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
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

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

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