-
Bug
-
Resolution: Fixed
-
P3
-
1.1.4
-
1.1.6
-
sparc
-
solaris_2.5
-
Verified
Issue | Fix Version | Assignee | Priority | Status | Resolution | Resolved In Build |
---|---|---|---|---|---|---|
JDK-2018134 | 1.2.0 | John Oconner | P3 | Closed | Fixed | 1.2beta4 |
Name: dfC67450 Date: 11/27/97
java.text.DecimalFormat.parse(String str, ParsePosition pp) loses precision
when str is parsed as double.
Here is the test demonstrating the bug:
-----------------Test.java------------------------
import java.text.*;
public class TestP {
public static void main (String args[]){
DecimalFormat df = new DecimalFormat();
String str = "0.1234";
Double d1 = new Double(str);
Double d2 = (Double) df.parse(str, new ParsePosition(0));
System.out.println(d1.doubleValue());
System.out.println(d2.doubleValue());
}
}
---------Output from the test---------------------
0.1234
0.12340000000000001
--------------------------------------------------
======================================================================
- backported by
-
JDK-2018134 java.text.DecimalFormat.parse() is inconsistent with Double(String) constructor
- Closed