ADDITIONAL SYSTEM INFORMATION :
OSX, JDK 8 Update 212
A DESCRIPTION OF THE PROBLEM :
Wrong rounding of .0002755
double v1 = .0002665d;
System.out.println(new DecimalFormat("#.000000").format(v1));
double v2 = .0002755d;
System.out.println(new DecimalFormat("#.000000").format(v2));
/* Result:
.000267
.000275
*/
STEPS TO FOLLOW TO REPRODUCE THE PROBLEM :
double v2 = .0002755d;
System.out.println(new DecimalFormat("#.000000").format(v2));
double v2 = .0002755d;
System.out.println(new DecimalFormat("#.######").format(v2));
EXPECTED VERSUS ACTUAL BEHAVIOR :
EXPECTED -
.000276
ACTUAL -
.000275
---------- BEGIN SOURCE ----------
double v2 = .0002755d;
System.out.println(new DecimalFormat("#.000000").format(v2));
---------- END SOURCE ----------
CUSTOMER SUBMITTED WORKAROUND :
3rd party libs or use python
FREQUENCY : always
OSX, JDK 8 Update 212
A DESCRIPTION OF THE PROBLEM :
Wrong rounding of .0002755
double v1 = .0002665d;
System.out.println(new DecimalFormat("#.000000").format(v1));
double v2 = .0002755d;
System.out.println(new DecimalFormat("#.000000").format(v2));
/* Result:
.000267
.000275
*/
STEPS TO FOLLOW TO REPRODUCE THE PROBLEM :
double v2 = .0002755d;
System.out.println(new DecimalFormat("#.000000").format(v2));
double v2 = .0002755d;
System.out.println(new DecimalFormat("#.######").format(v2));
EXPECTED VERSUS ACTUAL BEHAVIOR :
EXPECTED -
.000276
ACTUAL -
.000275
---------- BEGIN SOURCE ----------
double v2 = .0002755d;
System.out.println(new DecimalFormat("#.000000").format(v2));
---------- END SOURCE ----------
CUSTOMER SUBMITTED WORKAROUND :
3rd party libs or use python
FREQUENCY : always