title: Cython: unsigned int indices for numpy arrays gives different result
body: <p>I converted to cython a python function by just adding some types and compiling it.
  I was getting small numerical differences between the results of the python and cython functions.
  After some work I found that the differences came from accessing a numpy array using unsigned int instead of int.</p>
  
  <p>I was using unsigned int indices to speed up access according to: <a href="http://docs.cython.org/src/userguide/numpy_tutorial.html#tuning-indexing-further" rel="nofollow">http://docs.cython.org/src/userguide/numpy_tutorial.html#tuning-indexing-further</a></p>
  
  <p>anyway I thought it was harmless to use unsigned ints.</p>
  
  <p>See this code:</p>
  
  <pre><code>cpdef function(np.ndarray[np.float32_t, ndim=2] response, max_loc):
      cdef unsigned int x, y   
      x, y = int(max_loc[0]), int(max_loc[1])
      x2, y2 = int(max_loc[0]), int(max_loc[1])
      print response[y,x], type(response[y,x]), response.dtype
      print response[y2,x2], type(response[y2,x2]), response.dtype   
      print 2*(response[y,x] - min(response[y,x-1], response[y,x+1]))
      print 2*(response[y2,x2] - min(response[y2,x2-1], response[y2,x2+1]))  
  </code></pre>
  
  <p>prints:</p>
  
  <pre><code>0.959878861904 &lt;type 'float'&gt; float32
  0.959879 &lt;type 'numpy.float32'&gt; float32
  1.04306024313
  1.04306030273   
  </code></pre>
  
  <p>Why does this happen?!!! is it a bug?</p>
  
  <p>Ok, as requested here is a SSCCE with the same types and values that I used in my original function </p>
  
  <pre><code>cpdef function():
      cdef unsigned int x, y  
      max_loc2 = np.asarray([ 15., 25.], dtype=float) 
      cdef np.ndarray[np.float32_t, ndim=2] response2 = np.zeros((49,49), dtype=np.float32)    
      x, y = int(max_loc2[0]), int(max_loc2[1])
      x2, y2 = int(max_loc2[0]), int(max_loc2[1])
  
      response2[y,x] = 0.959878861904  
      response2[y,x-1] = 0.438348740339
      response2[y,x+1] = 0.753262758255  
  
  
      print response2[y,x], type(response2[y,x]), response2.dtype
      print response2[y2,x2], type(response2[y2,x2]), response2.dtype
      print 2*(response2[y,x] - min(response2[y,x-1], response2[y,x+1]))
      print 2*(response2[y2,x2] - min(response2[y2,x2-1], response2[y2,x2+1]))  
  </code></pre>
  
  <p>prints</p>
  
  <pre><code>0.959878861904 &lt;type 'float'&gt; float32
  0.959879 &lt;type 'numpy.float32'&gt; float32
  1.04306024313
  1.04306030273
  </code></pre>
  
  <p>I use python 2.7.3 cython 0.18 and msvc9 express </p>