[Numpy-discussion] Oddity with numpy.int64 integer division
Christian Marquardt
christian@marquardt...
Mon Apr 23 15:29:00 CDT 2007
Actually,
it happens for normal integers as well:
>>> n = np.array([-5, -100, -150])
>>> n // 100
array([ 0, -1, -1])
>>> -5//100, -100//100, -150//100
(-1, -1, -2)
On Mon, April 23, 2007 22:20, Christian Marquardt wrote:
> Dear all,
>
> this is odd:
>
> >>> import numpy as np
> >>> fact = 28250000L * 86400L
> >>> nn = np.array([-20905000L])
> >>> nn
> array([-20905000], dtype=int64)
> >>> nn[0] // fact
> 0
>
> But:
>
> >>> long(nn[0]) // fact
> -1L
>
> Is this a bug in numpy, or in python's implementation of longs? I would
> think both should give the same, really... (Python 2.5, numpy
> 1.0.3dev3725,
> Linux, Intel compilers...)
>
> Many thanks for any ideas / advice,
>
> Christian
>
> _______________________________________________
> Numpy-discussion mailing list
> Numpy-discussion@scipy.org
> http://projects.scipy.org/mailman/listinfo/numpy-discussion
>
More information about the Numpy-discussion
mailing list