[Numpy-discussion] log can't handle big ints

David Grant davidgrant at gmail.com
Wed Aug 16 13:45:27 CDT 2006


I am using numpy-0.9.8 and it seems that numpy's log2 function can't
handle large integers?

In [19]: a=11111111111111111111111111111111111111111111111111111111111111111111111111111111111111111

In [20]: math.log(a,2)
Out[20]: 292.48167544353294

In [21]: numpy.log2(a)
---------------------------------------------------------------------------
exceptions.AttributeError                            Traceback (most
recent call last)

/home/david/<ipython console>

/usr/lib/python2.4/site-packages/numpy/lib/ufunclike.py in log2(x, y)
     52     x = asarray(x)
     53     if y is None:
---> 54         y = umath.log(x)
     55     else:
     56         umath.log(x, y)

AttributeError: 'long' object has no attribute 'log'

Does anyone else get this in numpy? if not, what version are you using?

-- 
David Grant
http://www.davidgrant.ca




More information about the Numpy-discussion mailing list