in reply to finding the correct integer

That's a classic, computers use a binary representation for floats and many decimal fractions can't be represented w/o rounding errors

see Humans have too many fingers

Depending on use case there are different solutions, one is to calculate with integers without decimal fractions (like do currency in cent and add the point only at output)

PS: we had a similar discussion just recently

int() function

Cheers Rolf
(addicted to the Perl Programming Language :)
Wikisyntax for the Monastery