On Jan 26, 2008 12:39 AM, Tom Johnson <[EMAIL PROTECTED]> wrote:

> Hi, I'm having some troubles with long.
>
> >>> from numpy import log
> >>> log(8463186938969424928L)
> 43.5822574833
> >>> 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 [6]: import math

In [7]: math.log(10454852688145851272L)
Out[7]: 43.793597916587672

In [8]: float(10454852688145851272L)
Out[8]: 1.045485268814585e+19

Chuck
_______________________________________________
Numpy-discussion mailing list
[email protected]
http://projects.scipy.org/mailman/listinfo/numpy-discussion

Reply via email to