Python does have a Decimal class (in the decimal module), which you could use to avoid the imprecision of floats.
↧
Answer by Paul D. Waite for Checking if float is equivalent to an integer value in python
↧