[Numpy-discussion] Problems with long
Charles R Harris
Sat Jan 26 02:41:28 CST 2008
On Jan 26, 2008 12:39 AM, Tom Johnson <firstname.lastname@example.org> wrote:
> Hi, I'm having some troubles with long.
> >>> from numpy import log
> >>> log(8463186938969424928L)
> >>> log(10454852688145851272L)
> <type 'exceptions.AttributeError'>: 'long' object has no attribute 'log'
Numpy uses the standard C functions, so can't represent very large integers
exactly. However, given the precision of the log function, it might be
reasonable to truncate the digits and write the Python long as a float
before conversion. That's what Python does.
In : import math
In : math.log(10454852688145851272L)
In : float(10454852688145851272L)
-------------- next part --------------
An HTML attachment was scrubbed...
More information about the Numpy-discussion