-
Bug
-
Resolution: Not an Issue
-
P3
-
None
-
8u25
-
x86_64
-
windows_7
FULL PRODUCT VERSION :
java version "1.8.0_25"
Java(TM) SE Runtime Environment (build 1.8.0_25-b18)
Java HotSpot(TM) 64-Bit Server VM (build 25.25-b02, mixed mode)
ADDITIONAL OS VERSION INFORMATION :
Microsoft Windows [Version 6.1.7601]
A DESCRIPTION OF THE PROBLEM :
Problem with rounding up:
DecimalFormat l_format = new DecimalFormat();
l_format.setRoundingMode(RoundingMode.HALF_UP);
l_format.setMaximumFractionDigits(2);
l_format.getDecimalFormatSymbols().setDecimalSeparator('.');
System.out.println(l_format.format(13.135d));
With 2 fraction digits I think the output must be 13.14, but it is 13.13 even after the fix for Bug-ID: 8039915 (applied in the boot class path with the jdk8-dev sources).
REGRESSION. Last worked in version 7u72
STEPS TO FOLLOW TO REPRODUCE THE PROBLEM :
Just execute the code written in the description.
REPRODUCIBILITY :
This bug can be reproduced always.
---------- BEGIN SOURCE ----------
DecimalFormat l_format = new DecimalFormat();
l_format.setRoundingMode(RoundingMode.HALF_UP);
l_format.setMaximumFractionDigits(2);
l_format.getDecimalFormatSymbols().setDecimalSeparator('.');
assertEquals(13.14d, l_format.format(13.135d));
---------- END SOURCE ----------
java version "1.8.0_25"
Java(TM) SE Runtime Environment (build 1.8.0_25-b18)
Java HotSpot(TM) 64-Bit Server VM (build 25.25-b02, mixed mode)
ADDITIONAL OS VERSION INFORMATION :
Microsoft Windows [Version 6.1.7601]
A DESCRIPTION OF THE PROBLEM :
Problem with rounding up:
DecimalFormat l_format = new DecimalFormat();
l_format.setRoundingMode(RoundingMode.HALF_UP);
l_format.setMaximumFractionDigits(2);
l_format.getDecimalFormatSymbols().setDecimalSeparator('.');
System.out.println(l_format.format(13.135d));
With 2 fraction digits I think the output must be 13.14, but it is 13.13 even after the fix for Bug-ID: 8039915 (applied in the boot class path with the jdk8-dev sources).
REGRESSION. Last worked in version 7u72
STEPS TO FOLLOW TO REPRODUCE THE PROBLEM :
Just execute the code written in the description.
REPRODUCIBILITY :
This bug can be reproduced always.
---------- BEGIN SOURCE ----------
DecimalFormat l_format = new DecimalFormat();
l_format.setRoundingMode(RoundingMode.HALF_UP);
l_format.setMaximumFractionDigits(2);
l_format.getDecimalFormatSymbols().setDecimalSeparator('.');
assertEquals(13.14d, l_format.format(13.135d));
---------- END SOURCE ----------
- duplicates
-
JDK-8029896 Regression in NumberFormat rounding from 1.7 to 1.8. Rounding no longer works.
-
- Closed
-
- relates to
-
JDK-7131459 [Fmt-De] DecimalFormat produces wrong format() results when close to a tie
-
- Closed
-
-
JDK-8338242 RoundingMode.HALF_UP gives different results with NumberFormat
-
- Closed
-