views:

424

answers:

1

Hello everyone. I'm using GWT 2.0 and when I try to use NumberFormat to format a Double the results are not as expected:

NumberFormat format = NumberFormat.getFormat( "#.########" );
Double d = new Double("0.256281093911");
format.format(d);

formatted string: 0.02147484

As you can see the formatted value is wrong (this can be seen in the gwt showcase). Is this something related to the custom format I'm using (#.########)? or is this a bug in the GWT formatter? If this is a bug, have someone found a workaround? Thanks.

A: 

link text you might try NumberFormat.getDecimalFormat. Also, it might have something to do with your browser's locale and/or it's decimal delimiter.

Gipsy King