Why does type-conversion/multiplication fail in Python for certain cases? : <p>I'm certainly a newbie to Python. Hence, I'm struggling to understand the results that the following bit of code gives me for i = 15 and i = 21. In all other cases is does what I expect.</p>

<pre><code>import numpy as np

i_values = []
results = []
results2 = []

for i in range(27):
  i_values.append(i)
  result = np.int((i*0.02+0.03)*1.e2)
  results.append(result)

  result2 = (i*0.02+0.03)*1.e2
  results2.append(result2)

print i_values
print results
print results2
</code></pre>

<p>My question is: Why is the code working for most numbers but fails for certain values of i? I could solve the problem by </p>

<pre><code>result = np.int(np.rint(((i*0.02+0.03)*1.e2))
</code></pre>

<p>but I just want to understand why it occurs in the first place.</p>

<p>Thank you in advance.</p>
