On Fri, May 20, 2016 at 4:22 PM, Alan Isaac <alan.is...@gmail.com> wrote:
> On 5/19/2016 11:30 PM, Nathaniel Smith wrote: > >> the last bad >> option IMHO would be that we make int ** (negative int) an error in >> all cases, and the error message can suggest that instead of writing >> >> np.array(2) ** -2 >> >> they should instead write >> >> np.array(2) ** -2.0 >> >> (And similarly for np.int64(2) ** -2 versus np.int64(2) ** -2.0.) >> > > > > Fwiw, Haskell has three exponentiation operators > because of such ambiguities. I don't use C, but > I think the contrasting decision there was to > always return a double, which has a clear attraction > since for any fixed-width integral type, most of the > possible input pairs overflow the type. > > My core inclination would be to use (what I understand to be) > the C convention that integer exponentiation always produces > a double, but to support dtype-specific exponentiation with > a function. C doesn't have an exponentiation operator. The C math library has pow, powf and powl, which (like any C functions) are explicitly typed. Warren But this is just a user's perspective. > > Cheers, > Alan Isaac > > > _______________________________________________ > NumPy-Discussion mailing list > NumPy-Discussion@scipy.org > https://mail.scipy.org/mailman/listinfo/numpy-discussion >
_______________________________________________ NumPy-Discussion mailing list NumPy-Discussion@scipy.org https://mail.scipy.org/mailman/listinfo/numpy-discussion