[Numpy-discussion] Integers to integer powers

Nathaniel Smith njs at pobox.com
Fri May 20 18:54:41 EDT 2016


On May 20, 2016 12:44 PM, <josef.pktd at gmail.com> wrote:
[...]
>
> can numpy cast to float by default for power or **?

Maybe? The question is whether there are any valid use cases for getting
ints back:

>>> np.array([1, 2, 3]) ** 2
array([1, 4, 9])

It's not 100% obvious to me but intuitively this seems like an operation
that we probably want to support? Especially since there's a reasonable
range of int64 values that can't be represented exactly as floats.

-n
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.python.org/pipermail/numpy-discussion/attachments/20160520/1eb8667e/attachment.html>


More information about the NumPy-Discussion mailing list