Possible Duplicate:
Java floating point math - (conversion for feet/meters)
Java floating point arithmetic
I am running into the following problem in java.
This computation (0.196f * 100
) yields 19.599999487400055
instead of 19.6
.
I am puzzled. Can anyone please tell me why I get this odd result and how I can make sure I get the proper result without having to pollute my code with rounding all over the place.
Also what other jvm language deals with such problems better? Would scala be any different for example?