Integer multiplication overflow

Georg Simon georg.simon at bnmsp.de
Sun Oct 8 08:58:57 EDT 2000


number = 1
while 1 :
    number = number + 1
    print fact(number)

When I tried your function and the script above, I did not get
multiplication overflow but a very long trace back and then
RuntimeError: Maximum recursion depth exceeded
( RAM is 64MB )

Then I typed number and got 989

Georg


Nadav Horesh schrieb:
> 
> try:
> 
> def fact(num):
>   if num < 2: return 1L
>   return num * fact(num - 1)
> 
> Nadav.



More information about the Python-list mailing list