Duplicate :
|
|
Duplicate :
|
|
Duplicate :
|
|
Duplicate :
|
|
Duplicate :
|
|
Relates :
|
|
Relates :
|
|
Relates :
|
|
Relates :
|
|
Relates :
|
FULL PRODUCT VERSION : java version "1.8.0" Java(TM) SE Runtime Environment (build 1.8.0-b132) Java HotSpot(TM) Server VM (build 25.0-b70, mixed mode) ADDITIONAL OS VERSION INFORMATION : Linux paris 2.6.32-220.4.1.el6.i686 #1 SMP Mon Feb 6 16:10:45 CET 2012 i686 i686 i386 GNU/Linux A DESCRIPTION OF THE PROBLEM : Formating 0.950000550000 to a six fraction digits works properly, I get "0.950001". Formating 0.950000600000 to a six fraction digits works wrong, I get "0.95" instead of "0.950001". REGRESSION. Last worked in version 7u51 REPRODUCIBILITY : This bug can be reproduced always. ---------- BEGIN SOURCE ---------- @Test public void test_roundingOfDoubleValues() { NumberFormat format = DecimalFormat.getInstance( Locale.US ); format.setGroupingUsed( false ); format.setMaximumFractionDigits( 6 ); format.setRoundingMode( RoundingMode.HALF_UP ); String val95000055 = format.format( 0.950000550000 ); assertEquals( "0.950001", val95000055 ); // this is okay String val95000060 = format.format( 0.950000600000 ); assertEquals( "0.950001", val95000060 ); // this provides an error } ---------- END SOURCE ----------
|