Rounding number with python
Question: I was trying to calculate int((226553150*1023473145)/5.) using python and I
got 46374212988031352 although it should be 46374212988031350.


Answer: Remove the period for integer division:

    
    
    int((226553150*1023473145)/5)
    

Comes out as 46374212988031350 for me.

**Edit** after @tobias_k's comment: This only works in Python2, where `/` is
either floating point division (if either of the arguments is float) or
integer division (if both arguments are integers). In Python3 (or with `from
__future__ import division` in Python2) `/` is always floating point division
and the rounding problem comes up again, because the numbers you multiply are
too large to be exactly expressed in floating point.

The solution is either to use `//`, which is always integer division in all
Python versions or (if you really need the denominator to be float) to switch
to [mpmath](http://mpmath.org/), where you can increase the floating point
precision until you don't have the rounding errors anymore.

