title: Python rounding error with float numbers
body: <p>I don't know if this is an obvious bug, but while running a Python script for varying the parameters of a simulation, I realized the results with delta = 0.29 and delta = 0.58 were missing. On investigation, I noticed that the following Python code:</p>
  
  <pre><code>for i_delta in range(0, 101, 1):
    delta = float(i_delta) / 100
  
    (...)
  
  filename = 'foo' + str(int(delta * 100)) + '.dat'
  </code></pre>
  
  <p>generated identical files for delta = 0.28 and 0.29, same with .57 and .58, the reason being that python returns float(29)/100 as 0.28999999999999998. But that isn't a systematic error, not in the sense it happens to every integer. So I created the following Python script:</p>
  
  <pre><code>import sys
  
  n = int(sys.argv[1])
  
  for i in range(0, n + 1):
    a = int(100 * (float(i) / 100))
    if i != a: print i, a
  </code></pre>
  
  <p>And I can't see any pattern in the numbers for which this rounding error happens. Why does this happen with those particular numbers?</p>