[Numpy-discussion] log can't handle big ints
oliphant.travis at ieee.org
Wed Aug 16 14:20:43 CDT 2006
David Grant wrote:
> I am using numpy-0.9.8 and it seems that numpy's log2 function can't
> handle large integers?
> In : a=11111111111111111111111111111111111111111111111111111111111111111111111111111111111111111
> In : math.log(a,2)
> Out: 292.48167544353294
> In : numpy.log2(a)
Ufuncs on objects (like the long object) work by looking for the
corresponding method. It's not found for long objects.
Convert the long object to a float first. I'm not sure of any other
way to "fix" it. I suppose if no method is found an attempt to convert
them to floats could be performed under the covers on all object array
More information about the Numpy-discussion