[Numpy-discussion] Unexpected casting result

Warren Weckesser warren.weckesser at gmail.com
Mon Sep 16 13:54:29 EDT 2013


An unexpected casting result was just reported on stackoverflow:
http://stackoverflow.com/questions/18833639/attributeerror-in-python-numpy-when-constructing-function-for-certain-values

The following show the essence of the issue:

In [1]: np.__version__
Out[1]: '1.9.0.dev-6ce65d8'

In [2]: type(np.array(1.) * (2**64-1))
Out[2]: numpy.float64

In [3]: type(np.array(1.) * (2**64))
Out[3]: float

Note that the result of `np.array(1.0) * 2**64` is a Python float, not a
numpy float64.  Is this intentional?

(As pointed out in the stackoverflow question, the issue
https://github.com/numpy/numpy/issues/3409 is at least tangentially
related.)

Warren
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.python.org/pipermail/numpy-discussion/attachments/20130916/d9a536fd/attachment.html>


More information about the NumPy-Discussion mailing list