[Numpy-discussion] Proposal to make power return float, and other such things.

Sebastian Berg sebastian at sipsolutions.net
Tue Feb 18 07:06:32 EST 2014

On Di, 2014-02-18 at 11:44 +0000, Sturla Molden wrote:
> Robert Kern <robert.kern at gmail.com> wrote:
> > We're talking about numpy.power(), not just ndarray.__pow__(). The
> > equivalence of the two is indeed an implementation detail, but I do
> > think that it is useful to maintain the equivalence. If we didn't, it
> > would be the only exception, to my knowledge.
> But in this case it makes sence.
> math.pow(2,2) and 2**2 does not do the same. That is how Python behaves.

To be honest, that comparison only makes half sense to me. `math` are
all float (double precision) functions, basically you could just as well
call the library `fmath`...

I am -0.5 right now. `__pow__` already has special behaviour as opposed
to `np.power`, but these are for speed and don't change behaviour. T
he `uint` idea seems to just make things more complicated. If I am aware
of uint vs int, I am already aware I can just cast to float.

- Sebastian

> Sturla
> _______________________________________________
> NumPy-Discussion mailing list
> NumPy-Discussion at scipy.org
> http://mail.scipy.org/mailman/listinfo/numpy-discussion

More information about the NumPy-Discussion mailing list