[Numpy-discussion] Old tickets
Wed Mar 30 16:26:40 CDT 2011
On Wed, Mar 30, 2011 at 2:37 PM, Bruce Southey <email@example.com> wrote:
> This followup on tickets that I had previously indicated. So I want to
> thank Mark, Ralph and any people for going over those!
> For those that I followed I generally agreed with the outcome.
> Ticket 301: 'Make power and divide return floats from int inputs (like
> Invalid because the output dtype is the same as the input dtype unless
> you override using the dtype argument:
> >>> np.power(3, 1, dtype=np.float128).dtype
> Alternatively return a float and indicate in the docstring that the
> output dtype can be changed.
Just thought I'd note (on a python 2.6 system):
>>> import numpy as np
>>> a = np.array([1, 2, 3, 4])
>>> 2 / a
array([2, 1, 0, 0])
>>> from __future__ import division
>>> 2 / a
array([ 2. , 1. , 0.66666667, 0.5 ])
So, numpy already does this when true division is imported (and therefore
consistent with whatever the python environment does), and python currently
also returns integers for exponentials when both inputs are integers.
-------------- next part --------------
An HTML attachment was scrubbed...
More information about the NumPy-Discussion