JDK-4169083 : double-to-String conversion can result in extra digits
  • Type: Bug
  • Component: core-libs
  • Sub-Component: java.lang
  • Affected Version: 1.1,1.2.0,1.3.0
  • Priority: P4
  • Status: Open
  • Resolution: Unresolved
  • OS:
    generic,solaris_7,windows_nt,windows_2000 generic,solaris_7,windows_nt,windows_2000
  • CPU: unknown,x86
  • Submitted: 1998-08-26
  • Updated: 2018-09-14
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 Availability Release.

To download the current JDK release, click here.
Other
tbdUnresolved
Related Reports
Relates :  
Description
Conversion of a double value (and perhaps a float) to String
can result in more digits than are absolutely necessary, contrary to the JLS.
Attached is mail giving an number of good examples.

Name: yyT116575			Date: 03/13/2001


java version "1.3.0"
Java(TM) 2 Runtime Environment, Standard Edition (build 1.3.0-C)
Java HotSpot(TM) Client VM (build 1.3.0-C, mixed mode)

Execute the following class:

public strictfp class Test
{
    static public void main(String [] arg)
    {
        float f = 23.56f;
        double d = f;
        System.out.println(f + " " + d);
    }
}

The result is:

23.56 23.559999465942383

It seems that the results contradicts Java specification that explicitly says
that conversion from float to double in a strctfp expression should not lose
precision
(Review ID: 118747)
======================================================================
###@###.### 2004-11-11 21:43:45 GMT

Comments
Problem still exists in JDK 8-ea and 9-dev.
14-01-2014

CONVERTED DATA BugTraq+ Release Management Values COMMIT TO FIX: dragon
14-06-2004

PUBLIC COMMENTS Conversion of a double value (and perhaps a float) to String can result in more digits than are absolutely necessary, contrary to the JLS.
10-06-2004

EVALUATION Problems still exist in 1.4; these should be fixed. ###@###.### 2002-05-22 Decommitting from Tiger; problem should still be fixed in a future release. ###@###.### 2003-09-08
22-05-2002