Post Reply 
Fibonacci sequence by recursive algorithm fail
10-05-2015, 06:03 AM
Post: #23
RE: Fibonacci sequence by recursive algorithm fail
Hello,

The cas evaluator is recursive.
ie, each recursive function call that you make in a CAS program does result in a stack layer in the native program stack. And they add up quickly. And there is no way to control them (ie, know that you are running out of RAM). Your native program (which executes your CAS program) will crash, fast if the native program stack is small. This is why the CAS limits recursive user calls.

The Home evaluator, on the other hand is NON recursive. It handles evaluated programs in a while loop and handles user program recursivity using a manually managed stack. This results in a much more complex chunk of code, and might even be slower, BUT, it takes less RAM AND it allows the controled evaluation of deep recursive programs. Even low memory detection and proper error reporting.

Bernard's XCAS, I believe does have a non recursive evaluator, BUT I am not sure if it is implemented on Prime and even less sure of how to call it.

Cyrille

Although I work for the HP calculator group, the views and opinions I post here are my own. I do not speak for HP.
Find all posts by this user
Quote this message in a reply
Post Reply 


Messages In This Thread
RE: Fibonacci sequence by recursive algorithm fail - cyrille de brébisson - 10-05-2015 06:03 AM



User(s) browsing this thread: 2 Guest(s)