From: Robert Klemme Date: 2009-02-22T21:19:31+09:00 Subject: Re: floating point rounding error? On 22.02.2009 03:21, Raphael Clancy wrote: > Roger Pack wrote: >>> 3. standards (AFAIK the Float implementation is backed by an ISO >>> standard while I am not sure whether this is the case for BigDecimal). >> True. > > In this case, I think it's IEEE. Right, thanks for the correction! > I guess the take home is to avoid floats whenever you'll be doing any > rounding or truncating. I would not go as far. IMHO the take home should be awareness of the fact that mathematical numbers do not blend well with any computerized representation and that you always have to be careful when dealing with them. Floats are perfectly ok for a large number of applications so generally avoiding them seems a too harsh rule. Btw, if that were true then we could throw them out of the language without loss but I am pretty sure if you suggest that there would be vigorous objection. :-) Kind regards robert