-
Bug
-
Resolution: Duplicate
-
P3
-
None
-
8, 9
FULL PRODUCT VERSION :
java version "1.8.0_72"
Java(TM) SE Runtime Environment (build 1.8.0_72-b15)
Java HotSpot(TM) 64-Bit Server VM (build 25.72-b15, mixed mode)
ADDITIONAL OS VERSION INFORMATION :
CentOS release 5.3 (Final)
A DESCRIPTION OF THE PROBLEM :
The following code is supposed to print "1.235". In stead, it prints "1.234"
NumberFormat nf = NumberFormat.getInstance();
nf.setRoundingMode(RoundingMode.HALF_UP);
nf.setMaximumFractionDigits(3);
System.out.println(nf.format(1.2345));
REGRESSION. Last worked in version 7u80
ADDITIONAL REGRESSION INFORMATION:
java version "1.8.0_72"
Java(TM) SE Runtime Environment (build 1.8.0_72-b15)
Java HotSpot(TM) 64-Bit Server VM (build 25.72-b15, mixed mode)
STEPS TO FOLLOW TO REPRODUCE THE PROBLEM :
Run the code in description field
REPRODUCIBILITY :
This bug can be reproduced always.
---------- BEGIN SOURCE ----------
NumberFormat nf = NumberFormat.getInstance();
nf.setRoundingMode(RoundingMode.HALF_UP);
nf.setMaximumFractionDigits(3);
System.out.println(nf.format(1.2345));
---------- END SOURCE ----------
java version "1.8.0_72"
Java(TM) SE Runtime Environment (build 1.8.0_72-b15)
Java HotSpot(TM) 64-Bit Server VM (build 25.72-b15, mixed mode)
ADDITIONAL OS VERSION INFORMATION :
CentOS release 5.3 (Final)
A DESCRIPTION OF THE PROBLEM :
The following code is supposed to print "1.235". In stead, it prints "1.234"
NumberFormat nf = NumberFormat.getInstance();
nf.setRoundingMode(RoundingMode.HALF_UP);
nf.setMaximumFractionDigits(3);
System.out.println(nf.format(1.2345));
REGRESSION. Last worked in version 7u80
ADDITIONAL REGRESSION INFORMATION:
java version "1.8.0_72"
Java(TM) SE Runtime Environment (build 1.8.0_72-b15)
Java HotSpot(TM) 64-Bit Server VM (build 25.72-b15, mixed mode)
STEPS TO FOLLOW TO REPRODUCE THE PROBLEM :
Run the code in description field
REPRODUCIBILITY :
This bug can be reproduced always.
---------- BEGIN SOURCE ----------
NumberFormat nf = NumberFormat.getInstance();
nf.setRoundingMode(RoundingMode.HALF_UP);
nf.setMaximumFractionDigits(3);
System.out.println(nf.format(1.2345));
---------- END SOURCE ----------
- duplicates
-
JDK-8039915 Wrong NumberFormat.format() HALF_UP rounding when last digit exactly at rounding position greater than 5
-
- Closed
-