Computers are excellent calculators.. Not.
Now I'm pretty much used to dealing with floating point precision errors, but this one is just silly..
A fun example trying to calculate a ResMed pressure from a stored integer value, converted normally.
470.0 * 2.0 / 100.0 = 9.39999962
470.0 * 0.02 = 9.39999962
470.0 / 50.0 = 9.39999962
An even simpler example:
float var=9.4; // ie, the real answer, which even my foggy brain can work out..
the result that actually gets stored? 9.39999962!
Gah!! A standard floating point variable can not hold the number 9.4. It must be a dastardly evil unholy number.
Using 64bit double precision gives the answer for all of the above as 9.4000000000000004, also wrong.
Rounding to two decimal places is enough to get it to display right, and of course it won't really effect calculations (except the particular one I was working on that exposed it), but there is a heck of a lot to be said for using integer maths..
Did I mention I'm starting to hate computers.. ;)
Some more info as to why this happens for anyone who's interested: