-
Type:
Bug
-
Resolution: Duplicate
-
Priority:
P4
-
None
-
Affects Version/s: 8
-
Component/s: core-libs
-
generic
-
generic
A DESCRIPTION OF THE PROBLEM :
Using DecimalFormat with RoundingMode.HALF_UP doesn't round correct when last digit is 5 and have decimal place.
STEPS TO FOLLOW TO REPRODUCE THE PROBLEM :
DecimalFormat decimalFormat = new DecimalFormat("0.0");
decimalFormat.setRoundingMode(RoundingMode.HALF_UP);
decimalFormat.format(0.15);
---------- BEGIN SOURCE ----------
DecimalFormat decimalFormat = new DecimalFormat("0.0");
decimalFormat.setRoundingMode(RoundingMode.HALF_UP);
decimalFormat.format(0.15);
---------- END SOURCE ----------
Using DecimalFormat with RoundingMode.HALF_UP doesn't round correct when last digit is 5 and have decimal place.
STEPS TO FOLLOW TO REPRODUCE THE PROBLEM :
DecimalFormat decimalFormat = new DecimalFormat("0.0");
decimalFormat.setRoundingMode(RoundingMode.HALF_UP);
decimalFormat.format(0.15);
---------- BEGIN SOURCE ----------
DecimalFormat decimalFormat = new DecimalFormat("0.0");
decimalFormat.setRoundingMode(RoundingMode.HALF_UP);
decimalFormat.format(0.15);
---------- END SOURCE ----------
- duplicates
-
JDK-8252892 DecimalFormat does not round up properly for certain numbers with pattern 0.0
-
- Closed
-