Re: [Numpy-discussion] Integers to negative integer powers, time for a decision.

2016-10-12 Thread Marten van Kerkwijk
I still strongly favour ending up at int**int -> float, and like Peter's suggestion of raising a general warning rather than an exception for negative powers. -- Marten ___ NumPy-Discussion mailing list NumPy-Discussion@scipy.org https://mail.scipy.org/m

Re: [Numpy-discussion] Integers to negative integer powers, time for a decision.

2016-10-11 Thread Peter Creasey
> On Sun, Oct 9, 2016 at 12:59 PM, Stephan Hoyer wrote: > >> >> I agree with Sebastian and Nathaniel. I don't think we can deviating from >> the existing behavior (int ** int -> int) without breaking lots of existing >> code, and if we did, yes, we would need a new integer power function. >> >> I

Re: [Numpy-discussion] Integers to negative integer powers, time for a decision.

2016-10-10 Thread Ryan May
On Sun, Oct 9, 2016 at 12:59 PM, Stephan Hoyer wrote: > On Sun, Oct 9, 2016 at 6:25 AM, Sebastian Berg > wrote: > >> For what its worth, I still feel it is probably the only real option to >> go with error, changing to float may have weird effects. Which does not >> mean it is impossible, I admi

Re: [Numpy-discussion] Integers to negative integer powers, time for a decision.

2016-10-09 Thread Stephan Hoyer
On Sun, Oct 9, 2016 at 6:25 AM, Sebastian Berg wrote: > For what its worth, I still feel it is probably the only real option to > go with error, changing to float may have weird effects. Which does not > mean it is impossible, I admit, though I would like some data on how > downstream would handl

Re: [Numpy-discussion] Integers to negative integer powers, time for a decision.

2016-10-09 Thread Sebastian Berg
On Fr, 2016-10-07 at 19:12 -0600, Charles R Harris wrote: > Hi All, > > The time for NumPy 1.12.0 approaches and I like to have a final > decision on the treatment of integers to negative integer powers with > the `**` operator. The two alternatives looked to be > > Raise an error for arrays and

Re: [Numpy-discussion] Integers to negative integer powers, time for a decision.

2016-10-09 Thread Krisztián Horváth
> Sounds good to me. I agree that we should prioritize within-numpy > consistency over consistency with Python. > I agree with that. Because of numpy consitetncy, the `**` operator should always return float. Right now the case is: >>> aa = np.arange(2, 10, dtype=int) array([2, 3, 4, 5, 6, 7, 8,

Re: [Numpy-discussion] Integers to negative integer powers, time for a decision.

2016-10-08 Thread Ralf Gommers
On Sun, Oct 9, 2016 at 4:12 AM, Nathaniel Smith wrote: > On Sat, Oct 8, 2016 at 6:59 AM, Charles R Harris > wrote: > > > > > > On Sat, Oct 8, 2016 at 4:40 AM, Nathaniel Smith wrote: > >> > >> On Fri, Oct 7, 2016 at 6:12 PM, Charles R Harris > >> wrote: > >> > Hi All, > >> > > >> > The time for

Re: [Numpy-discussion] Integers to negative integer powers, time for a decision.

2016-10-08 Thread Nathaniel Smith
On Sat, Oct 8, 2016 at 3:18 PM, Krisztián Horváth wrote: > > > >> but then that violates the numpy >> principle that output dtypes should be determined entirely by input >> dtypes, without peeking at the actual values. (And this rule is very >> important for avoiding nasty surprises when you run y

Re: [Numpy-discussion] Integers to negative integer powers, time for a decision.

2016-10-08 Thread Krisztián Horváth
but then that violates the numpy > principle that output dtypes should be determined entirely by input > dtypes, without peeking at the actual values. (And this rule is very > important for avoiding nasty surprises when you run your code on new > inputs.) > At division you get back an array of floa

Re: [Numpy-discussion] Integers to negative integer powers, time for a decision.

2016-10-08 Thread Nathaniel Smith
On Sat, Oct 8, 2016 at 1:40 PM, V. Armando Sole wrote: > Well, testing under windows 64 bit, Python 3.5.2, positive powers of > integers give integers and negative powers of integers give floats. So, do > you want to raise an exception when taking a negative power of an element of > an array of in

Re: [Numpy-discussion] Integers to negative integer powers, time for a decision.

2016-10-08 Thread V. Armando Sole
Well, testing under windows 64 bit, Python 3.5.2, positive powers of integers give integers and negative powers of integers give floats. So, do you want to raise an exception when taking a negative power of an element of an array of integers? Because not doing so would be inconsistent with rais

Re: [Numpy-discussion] Integers to negative integer powers, time for a decision.

2016-10-08 Thread Krisztián Horváth
Sorry, I was not clear enough. I meant that the second option (always float) would be more coherent with Python3. On Oct 8, 2016 9:36 PM, "Charles R Harris" wrote: On Sat, Oct 8, 2016 at 1:31 PM, Krisztián Horváth wrote: > Hello, > > I think it should be consistent with Python3. So, it shoul

Re: [Numpy-discussion] Integers to negative integer powers, time for a decision.

2016-10-08 Thread Charles R Harris
On Sat, Oct 8, 2016 at 1:31 PM, Krisztián Horváth wrote: > Hello, > > I think it should be consistent with Python3. So, it should give back a > float. > > Best regards, > Krisztian > > Can't do that and also return integers for positive powers. It isn't possible to have behavior completely compat

Re: [Numpy-discussion] Integers to negative integer powers, time for a decision.

2016-10-08 Thread Krisztián Horváth
Hello, I think it should be consistent with Python3. So, it should give back a float. Best regards, Krisztian On Sat, Oct 8, 2016 at 3:12 AM, Charles R Harris wrote: > Hi All, > > The time for NumPy 1.12.0 approaches and I like to have a final decision > on the treatment of integers to negativ

Re: [Numpy-discussion] Integers to negative integer powers, time for a decision.

2016-10-08 Thread Charles R Harris
On Sat, Oct 8, 2016 at 9:12 AM, Nathaniel Smith wrote: > On Sat, Oct 8, 2016 at 6:59 AM, Charles R Harris > wrote: > > > > > > On Sat, Oct 8, 2016 at 4:40 AM, Nathaniel Smith wrote: > >> > >> On Fri, Oct 7, 2016 at 6:12 PM, Charles R Harris > >> wrote: > >> > Hi All, > >> > > >> > The time for

Re: [Numpy-discussion] Integers to negative integer powers, time for a decision.

2016-10-08 Thread Nathaniel Smith
On Sat, Oct 8, 2016 at 6:59 AM, Charles R Harris wrote: > > > On Sat, Oct 8, 2016 at 4:40 AM, Nathaniel Smith wrote: >> >> On Fri, Oct 7, 2016 at 6:12 PM, Charles R Harris >> wrote: >> > Hi All, >> > >> > The time for NumPy 1.12.0 approaches and I like to have a final decision >> > on >> > the t

Re: [Numpy-discussion] Integers to negative integer powers, time for a decision.

2016-10-08 Thread Charles R Harris
On Sat, Oct 8, 2016 at 4:40 AM, Nathaniel Smith wrote: > On Fri, Oct 7, 2016 at 6:12 PM, Charles R Harris > wrote: > > Hi All, > > > > The time for NumPy 1.12.0 approaches and I like to have a final decision > on > > the treatment of integers to negative integer powers with the `**` > operator.

Re: [Numpy-discussion] Integers to negative integer powers, time for a decision.

2016-10-08 Thread Nathaniel Smith
On Fri, Oct 7, 2016 at 6:12 PM, Charles R Harris wrote: > Hi All, > > The time for NumPy 1.12.0 approaches and I like to have a final decision on > the treatment of integers to negative integer powers with the `**` operator. > The two alternatives looked to be > > Raise an error for arrays and num

Re: [Numpy-discussion] Integers to negative integer powers, time for a decision.

2016-10-07 Thread V. Armando Sole
Hi all, Just to have the options clear. Is the operator '**' going to be handled in any different manner than pow? Thanks. Armando ___ NumPy-Discussion mailing list NumPy-Discussion@scipy.org https://mail.scipy.org/mailman/listinfo/numpy-discussion

Re: [Numpy-discussion] Integers to negative integer powers, time for a decision.

2016-10-07 Thread Alan Isaac
On 10/7/2016 9:12 PM, Charles R Harris wrote: *Always return a float * /Pluses/ * Computational convenience Is the behavior of C++11 of any relevance to the choice? http://www.cplusplus.com/reference/cmath/pow/ Alan Isaac ___ NumPy-Discussion mai

Re: [Numpy-discussion] Integers to negative integer powers, time for a decision.

2016-10-07 Thread josef . pktd
On Fri, Oct 7, 2016 at 9:12 PM, Charles R Harris wrote: > Hi All, > > The time for NumPy 1.12.0 approaches and I like to have a final decision on > the treatment of integers to negative integer powers with the `**` operator. > The two alternatives looked to be > > Raise an error for arrays and num