Post Reply 
Probable bug
01-20-2016, 06:16 AM
Post: #6
RE: Probable bug
Hello,

Infinite recursion detection is not as easy as it sounds unfortunately.
In the calculator, Un is, more or less, a program. Like a user function.

How would the computer detect that Function(n) is infinitely recursive?
Testing that there are multiple calls in the stack for the same function with the same arguments sounds like a good idea, BUT it has some drawbacks.
1) It is quite slow and would/could slow down the calculator significantly.
2) Because functions can use global variables, the fact that a function calls itself with the same arguments recursively does not always mean that it is infinitely recursive. For example:

Count= 10;
export rec(a)
if Count:= Count-1 then
rec(a);
end;
return a+1;
end;

This function is NOT infinitely recursive, but it would be very hard for the program elevator to detect it.

It would be nice to have some type of detection nevertheless, I agree...

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
Probable bug - jefierro - 01-18-2016, 01:56 PM
RE: Probable bug - cyrille de brébisson - 01-19-2016, 06:03 AM
RE: Probable bug - jefierro - 01-19-2016, 06:14 AM
RE: Probable bug - primer - 01-19-2016, 12:52 PM
RE: Probable bug - jefierro - 01-19-2016, 02:02 PM
RE: Probable bug - cyrille de brébisson - 01-20-2016 06:16 AM
RE: Probable bug - Gerald H - 01-20-2016, 08:19 AM
RE: Probable bug - jefierro - 01-20-2016, 02:04 PM



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