java.text.DecimalFormat



Hi,

The following piece of code is producing an odd result. Upon execution
s1="2199.76" whilst strangely s2="2199.77".

java.text.DecimalFormat DF = new java.text.DecimalFormat("#,##0.00", new
DecimalFormatSymbols( Locale.US ) );

double d1 = 2199.76;
String s1 = DF.format( d1 );

double d2 = 2199.7599999999998;
String s2 = DF.format( d2 );

Does anyone have any thoughts on why this is the case? Is it simply a bug in
DecimalFormat?

Note that Sun's jvm produces "2199.76" for both strings.
.