Issue | Fix Version | Assignee | Priority | Status | Resolution | Resolved In Build |
---|---|---|---|---|---|---|
JDK-2181423 | OpenJDK6 | Joe Darcy | P3 | Resolved | Fixed | b17 |
Name: yyT116575 Date: 03/20/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)
public class Dobble {
public static void main( String[] args ) {
System.out.println(0.001);
System.out.println(0.001f);
System.out.println(1.001);
System.out.println(1.001f);
System.out.println(0.1);
System.out.println(0.1f);
System.out.println(0.01);
System.out.println(0.01f);
System.out.println(0.0001);
System.out.println(0.0001f);
}
}
This gives an output of 0.0010 for actual value 0.001, which is inconsistent
with other numbers (compare other lines output).
This happens for all of 0.001, 0.002, ..., 0.009.
It occurs on jdk1.3 & jdk1.2.2 on windows and jdk1.2.2 on a sparc.
(Review ID: 119151)
======================================================================
Name: rmT116609 Date: 02/11/2002
java version "1.4.0-rc"
Java(TM) 2 Runtime Environment, Standard Edition (build 1.4.0-rc-b91)
Java HotSpot(TM) Client VM (build 1.4.0-rc-b91, mixed mode)
DESCRIPTION OF THE PROBLEM :
---------- BEGIN SOURCE ----------
public class PrecisionTest {
public static void main(String[] args) {
System.out.println(Double.valueOf("0.003"));
}
}
---------- END SOURCE ----------
System.out.println(Double.valueOf("0.003"));
Output will be 0.0030. I expect it to be 0.003.
(Review ID: 139078)
======================================================================
###@###.### 2004-11-11 21:41:23 GMT
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)
public class Dobble {
public static void main( String[] args ) {
System.out.println(0.001);
System.out.println(0.001f);
System.out.println(1.001);
System.out.println(1.001f);
System.out.println(0.1);
System.out.println(0.1f);
System.out.println(0.01);
System.out.println(0.01f);
System.out.println(0.0001);
System.out.println(0.0001f);
}
}
This gives an output of 0.0010 for actual value 0.001, which is inconsistent
with other numbers (compare other lines output).
This happens for all of 0.001, 0.002, ..., 0.009.
It occurs on jdk1.3 & jdk1.2.2 on windows and jdk1.2.2 on a sparc.
(Review ID: 119151)
======================================================================
Name: rmT116609 Date: 02/11/2002
java version "1.4.0-rc"
Java(TM) 2 Runtime Environment, Standard Edition (build 1.4.0-rc-b91)
Java HotSpot(TM) Client VM (build 1.4.0-rc-b91, mixed mode)
DESCRIPTION OF THE PROBLEM :
---------- BEGIN SOURCE ----------
public class PrecisionTest {
public static void main(String[] args) {
System.out.println(Double.valueOf("0.003"));
}
}
---------- END SOURCE ----------
System.out.println(Double.valueOf("0.003"));
Output will be 0.0030. I expect it to be 0.003.
(Review ID: 139078)
======================================================================
###@###.### 2004-11-11 21:41:23 GMT
- backported by
-
JDK-2181423 System.out.println(0.001) outputs 0.0010
- Resolved
- duplicates
-
JDK-5078240 Double.toString(double) adds a trailing zero in certain cases
- Closed
-
JDK-6575880 Float.toString(float) adds trailing zeros
- Closed
- relates to
-
JDK-6935102 Regtest closed/sun/misc/FloatingDecimal/ToString.java now failing.
- Closed
-
JDK-4154042 java.lang.FloatingDecimal could be eliminated
- Closed