Python large iterations number fail
I wrote simple monte-carlo π calculation program in Python, using multiprocessing module. It works just fine, but when I pass 1E+10 iterations for each worker, some problem occur, and the result is wrong. I cant understand what is the problem, because everything is fine on 1E+9 iterations! import sys from multiprocessing import Pool from random import random def calculate_pi(iters): """ Worker function """ points = 0 # points inside circle for i in iters: x = random() y = random() if x ** 2 + y ** 2 <= 1: points += 1 return points if __name__ == "__main__": if len(sys.argv) != 3: print "Usage: