[Numpy-discussion] numpy log2 has bug
from numpy import log2, __version__ log2(2**63) Traceback (most recent call last): File stdin, line 1, in module AttributeError: log2 __version__ '2.0.0.dev-1fe8136' (doesn't work with 1.3.0 as well) ___ NumPy-Discussion mailing list NumPy-Discussion@scipy.org http://mail.scipy.org/mailman/listinfo/numpy-discussion
Re: [Numpy-discussion] numpy log2 has bug
2011/3/23 Dmitrey tm...@ukr.net: from numpy import log2, __version__ log2(2**63) Traceback (most recent call last): File stdin, line 1, in module AttributeError: log2 __version__ '2.0.0.dev-1fe8136' (doesn't work with 1.3.0 as well) np.array([2**63]) array([9223372036854775808], dtype=object) log2(2.**63) 62.993 log2(2**63) Traceback (most recent call last): File pyshell#9, line 1, in module log2(2**63) AttributeError: log2 integer conversion problem Josef ___ NumPy-Discussion mailing list NumPy-Discussion@scipy.org http://mail.scipy.org/mailman/listinfo/numpy-discussion ___ NumPy-Discussion mailing list NumPy-Discussion@scipy.org http://mail.scipy.org/mailman/listinfo/numpy-discussion
Re: [Numpy-discussion] numpy log2 has bug
On Wed, Mar 23, 2011 at 13:51, josef.p...@gmail.com wrote: 2011/3/23 Dmitrey tm...@ukr.net: from numpy import log2, __version__ log2(2**63) Traceback (most recent call last): File stdin, line 1, in module AttributeError: log2 __version__ '2.0.0.dev-1fe8136' (doesn't work with 1.3.0 as well) np.array([2**63]) array([9223372036854775808], dtype=object) log2(2.**63) 62.993 log2(2**63) Traceback (most recent call last): File pyshell#9, line 1, in module log2(2**63) AttributeError: log2 integer conversion problem Right. numpy cannot safely convert a long object of that size to a dtype it knows about, so it leaves it as an object array. Most ufuncs operate on object arrays by looking for a method on each element with the name of the ufunc. So np.log2(np.array([x], dtype=object)) will look for x.log2(). -- Robert Kern I have come to believe that the whole world is an enigma, a harmless enigma that is made terrible by our own mad attempt to interpret it as though it had an underlying truth. -- Umberto Eco ___ NumPy-Discussion mailing list NumPy-Discussion@scipy.org http://mail.scipy.org/mailman/listinfo/numpy-discussion