floats are inherently limited in their precision, and some numbers just can't be expressed precisely using them. "0.1" is such a number, as is "0.9". Using doubles makes things a bit better (around 14 exact decimals instead of 7 or so), but the basic problem is the same. (If you're interested in the gory details, read up on
What Every Computer Scientist Should Know About Floating-Point Arithmetic.)
If you require exact floating point arithmetic, you can use the java.math.BigDecimal class.
[ August 09, 2005: Message edited by: Ulf Dittmer ]