XR (exact real arithmetic) question please?

Tim Peters tim_one at email.msn.com
Sat May 24 23:03:58 EDT 2003


[Colin Finlay]
> I am using the
> XR (exact real arithmetic).py function XR.py
> and after some time a error message comes up.
>
> QUOTE
>   File "XR.py", line 401, in <lambda>
>     return XR(XR.memo(lambda n: (x(n+2)+y(n+2)+2)>>2))
> RuntimeError: maximum recursion depth exceeded
> UNQUOTE
>
> What does this mean please?

How familiar are you with programming?  If "very", it means what it says
<wink> -- in order to prevent stack-fault crashes, Python monitors
call-stack depth and raises this exception when that exceeds
sys.getrecursionlimit():

>>> import sys
>>> sys.getrecursionlimit()
1000
>>>

That's set to 1000 by default.  You can try boosting it by calling
sys.setrecursionlimit(some_bigger_number), but then you risk the program
dying in a more unpleasant way (probably a hardware exception when the C
stack overflows).

This kind of program dies in the same way:

def f():
    f()
f()

The real cause is either a bug in XR.py, or that you're trying a problem
instance that requires more stack memory than your computer has.  It's
impossible to say which without knowing everything you did to get to this
point, and without knowledge of what XR.py's author intended.  If you think
what you're doing is reasonable and "should work", your best bet is to
contact the program's author (I doubt anyone here is familiar with the
internal workings of that program).






More information about the Python-list mailing list