Safest way to convert float to integer in python?
All integers that can be represented by floating point numbers have an exact representation. So you can safely use int on the result. Inexact representations occur only if you are trying to represent a rational number with a denominator that is not a power of two. That this works is not trivial at all! It’s a property … Read more