Re: [Numpy-discussion] Floor divison on int returns float

2016-04-14 Thread Antoine Pitrou
On Wed, 13 Apr 2016 15:49:15 -0600 Charles R Harris wrote: > > I looked this up once, `C` returns unsigned in the scalar case when both > operands have the same width. See Usual Arithmetic Conversions >

Re: [Numpy-discussion] Floor divison on int returns float

2016-04-13 Thread Charles R Harris
On Wed, Apr 13, 2016 at 2:48 PM, Nathaniel Smith wrote: > On Apr 13, 2016 9:08 AM, "Robert Kern" wrote: > > > > On Wed, Apr 13, 2016 at 3:17 AM, Antony Lee > wrote: > > > > > > This kind of issue (see also > https://github.com/numpy/numpy/issues/3511) has become more annoying now > that indexin

Re: [Numpy-discussion] Floor divison on int returns float

2016-04-13 Thread Nathaniel Smith
On Apr 13, 2016 9:08 AM, "Robert Kern" wrote: > > On Wed, Apr 13, 2016 at 3:17 AM, Antony Lee wrote: > > > > This kind of issue (see also https://github.com/numpy/numpy/issues/3511) > > has become more annoying now that indexing requires integers (indexing with > > a float raises a VisibleDepre

Re: [Numpy-discussion] Floor divison on int returns float

2016-04-13 Thread Robert Kern
On Wed, Apr 13, 2016 at 3:17 AM, Antony Lee wrote: > > This kind of issue (see also https://github.com/numpy/numpy/issues/3511) has become more annoying now that indexing requires integers (indexing with a float raises a VisibleDeprecationWarning). The argument "dividing an uint by an int may giv

Re: [Numpy-discussion] Floor divison on int returns float

2016-04-12 Thread Antony Lee
Whatever the C rules are (which I don't know off the top of my head, but I guess it must be one of uint64 or int64). It's not as if conversion to float64 was lossless: In [38]: 2**63 - (np.int64(2**62-1) + np.uint64(2**62-1)) Out[38]: 0.0 Note that the result of (np.int64(2**62-1) + np.uint64(2

Re: [Numpy-discussion] Floor divison on int returns float

2016-04-12 Thread Nathaniel Smith
So what type should uint64 + int64 return? On Apr 12, 2016 7:17 PM, "Antony Lee" wrote: > This kind of issue (see also https://github.com/numpy/numpy/issues/3511) > has become more annoying now that indexing requires integers (indexing with > a float raises a VisibleDeprecationWarning). The argu

Re: [Numpy-discussion] Floor divison on int returns float

2016-04-12 Thread Antony Lee
This kind of issue (see also https://github.com/numpy/numpy/issues/3511) has become more annoying now that indexing requires integers (indexing with a float raises a VisibleDeprecationWarning). The argument "dividing an uint by an int may give a result that does not fit in an uint nor in an int" d

Re: [Numpy-discussion] Floor divison on int returns float

2016-04-12 Thread T J
Thanks Eric. Also relevant: https://github.com/numba/numba/issues/909 Looks like Numba has found a way to avoid this edge case. On Monday, April 4, 2016, Eric Firing wrote: > On 2016/04/04 9:23 AM, T J wrote: > >> I'm on NumPy 1.10.4 (mkl). >> >> >>> np.uint(3) // 2 # 1.0 >> >>> 3 // 2

Re: [Numpy-discussion] Floor divison on int returns float

2016-04-04 Thread Eric Firing
On 2016/04/04 9:23 AM, T J wrote: I'm on NumPy 1.10.4 (mkl). >>> np.uint(3) // 2 # 1.0 >>> 3 // 2 # 1 Is this behavior expected? It's certainly not desired from my perspective. If this is not a bug, could someone explain the rationale to me. Thanks. I agree that it's almost always unde

[Numpy-discussion] Floor divison on int returns float

2016-04-04 Thread T J
I'm on NumPy 1.10.4 (mkl). >>> np.uint(3) // 2 # 1.0 >>> 3 // 2 # 1 Is this behavior expected? It's certainly not desired from my perspective. If this is not a bug, could someone explain the rationale to me. Thanks. ___ NumPy-Discussion mailing lis