[Numpy-discussion] Integers to integer powers, let's make a decision
Alan Isaac
alan.isaac at gmail.com
Mon Jun 13 10:05:08 EDT 2016
On 6/13/2016 4:47 AM, Antoine Pitrou wrote:
> Currently, the choice is simple: if you want an int output,
> have an int input; if you want a float output, have a float output.
That is a misunderstanding, which may be influencing the discussion.
Examples of complications:
>>> type(np.int8(2)**2)
<type 'numpy.int32'>
>>> type(np.uint64(2)**np.int8(2))
<type 'numpy.float64'>
I don't think anyone has proposed first principles
from which the desirable behavior could be deduced.
I do think reference to the reasoning used by other
languages in making this decision could be helpful.
Alan Isaac
(on Windows)
More information about the NumPy-Discussion
mailing list