-
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-2017488 | 1.2.0 | John Oconner | P3 | Closed | Fixed | 1.2beta4 |
Name: dfC67450 Date: 10/21/97
java.text.DecimalFormat.format(double, StringBuffer, FieldPosition) formats 0.0
as the empty string when MinimumIntegerDigits setting is 0.
Here is the test demonstrating the bug:
-----------------Test.java------------------------
import java.text.*;
public class Test {
public static void main (String args[]){
DecimalFormat df = new DecimalFormat();
df.setMinimumIntegerDigits(0);
double n = 0;
System.out.println(n + ": '" + df.format(n) + "'");
n = 0.1;
System.out.println(n + ": '" + df.format(n) + "'");
}
}
---------Output from the test---------------------
0.0: ''
0.1: '.1'
--------------------------------------------------
======================================================================
- backported by
-
JDK-2017488 java.text.DecimalFormat.format() incorrectly formats 0.0
-
- Closed
-