Re: [Numpy-discussion] Rationale for integer promotion rules

2015-07-17 Thread Sturla Molden
Matthew Brett wrote: >>> Furthermore, adding int64 >>> and uint64 returns float64. >> >> This is a grievous kluge, on the grounds that no-one is really sure >> *what* to do in this case. > > It doesn't seem unreasonable to me : casting int64 to uint64 or uint64 > to int64 could lead to disastr

Re: [Numpy-discussion] Rationale for integer promotion rules

2015-07-16 Thread Antoine Pitrou
On Thu, 16 Jul 2015 11:14:10 -0700 Nathaniel Smith wrote: > > > > Also, it is set to stay like this, or will it evolve in the future? > > I don't know -- if you make a good case for something better then maybe? No, I was just wondering if it would be a good use of our time to try to use a scheme

Re: [Numpy-discussion] Rationale for integer promotion rules

2015-07-16 Thread Antoine Pitrou
On Thu, 16 Jul 2015 19:19:58 +0100 Robert Kern wrote: > On Thu, Jul 16, 2015 at 7:14 PM, Nathaniel Smith wrote: > > > > On Thu, Jul 16, 2015 at 9:18 AM, Antoine Pitrou > wrote: > > > > while adding int8 and uint8 will give int16 as result > > > (promoting to the smallest fitting type). > > > >

Re: [Numpy-discussion] Rationale for integer promotion rules

2015-07-16 Thread Matthew Brett
On Thu, Jul 16, 2015 at 7:14 PM, Nathaniel Smith wrote: > On Thu, Jul 16, 2015 at 9:18 AM, Antoine Pitrou wrote: >> >> Hi, >> >> We were discussion integer promotion rules amongst the Numba team, and >> we were wondering about the rationale for Numpy's rules. For example, >> adding int8 and int8

Re: [Numpy-discussion] Rationale for integer promotion rules

2015-07-16 Thread Robert Kern
On Thu, Jul 16, 2015 at 7:14 PM, Nathaniel Smith wrote: > > On Thu, Jul 16, 2015 at 9:18 AM, Antoine Pitrou wrote: > > while adding int8 and uint8 will give int16 as result > > (promoting to the smallest fitting type). > > I understand this to be a consequence of the previous rule (results > sho

Re: [Numpy-discussion] Rationale for integer promotion rules

2015-07-16 Thread Nathaniel Smith
On Thu, Jul 16, 2015 at 9:18 AM, Antoine Pitrou wrote: > > Hi, > > We were discussion integer promotion rules amongst the Numba team, and > we were wondering about the rationale for Numpy's rules. For example, > adding int8 and int8 will give int8 as result (with potential > magnitude loss), I b

[Numpy-discussion] Rationale for integer promotion rules

2015-07-16 Thread Antoine Pitrou
Hi, We were discussion integer promotion rules amongst the Numba team, and we were wondering about the rationale for Numpy's rules. For example, adding int8 and int8 will give int8 as result (with potential magnitude loss), while adding int8 and uint8 will give int16 as result (promoting to the