Sebastian Haase wrote: > Hi, > why does > numpy.round(a) > return a float ?
Partly because that's what the underlying C standard library function does and what the Python function round() does. The reason they do that is because the range of integers supported by the double precision floating point type is larger than the range of integers supported by C ints. In [17]: numpy.round(1e16) Out[17]: 1e+16 In [18]: numpy.round(1e16).astype(int) Out[18]: -2147483648 > I need something that I can use as indices for another array. Do I > have to (implicitly) create a temporary array and use: > N.round(a).astype(N.int) ? Yup. -- Robert Kern "I have come to believe that the whole world is an enigma, a harmless enigma that is made terrible by our own mad attempt to interpret it as though it had an underlying truth." -- Umberto Eco _______________________________________________ Numpy-discussion mailing list Numpy-discussion@scipy.org http://projects.scipy.org/mailman/listinfo/numpy-discussion