Chad Pilkington - 2008-02-27

I import a lot of number for excel into applications.  I run into the following problem with rounding.

Excel formated number = 0.11%
Excel underlying number = 0.105%

The problem is when I use getContents() it return 0.10% even though round_half_up is set.
So, I use getValue() of the NumberCell and I get a double 0.00104999999999999999935121341995467414......
This number of course when rounded should give you  0.0010 logically. so as far as I can see the logic is working as expected unfortunately it is not what it should do.

Internally java is representing the value in a way that makes it round incorrectly.  Do you have a suggestion on how to get the number accurately.