Long overflow problem

Tom bondpaper at earthlink.net
Wed Nov 6 18:15:20 EST 2002


In article <yu99n0oml9zj.fsf at europa.research.att.com>,
 Andrew Koenig <ark at research.att.com> wrote:

> Tom> If I call the function as such: myFunc(2382373743L, 2382772391L), I get 
> Tom> the following error:
> 
> Tom> OverflowError: Long int too long to convert to int. 
> 
> Tom> I can't seem to get myFunc to understand that i and j are long integers. 
> Tom> How would I go about doing this?
> 
> It looks like myFunc is trying to do something with one of its
> arguments that requires an int and will not accept a long.
> Without seeing what myFunc does, it's hard to know what that
> operation might be.

My apologies...

Since I received the error right as the function was being called, I 
assumed that it had to do with the way that the parameters were being 
passed. Basically I was attempting to cycle through a series of very 
large numbers looking for primes. The two numbers passed to myFunc 
denote the starting and ending values.  Even if I break this down to 
something more basic like:

def myFunc (i, j):
   for a in range(i, j):
      print a

I get the same error. Are there any implicit conversions going on here?

Thanks.

Tom



More information about the Python-list mailing list