Post Reply 
Calc Crash (Real and Virtual)
09-09-2016, 07:26 PM (This post was last modified: 09-09-2016 07:27 PM by toml_12953.)
Post: #1
Calc Crash (Real and Virtual)
When I run the following program to compute the Ackermann function, both the virtual and real calculators crash. I expected to get an error but not a crash.
Try running it for X=4 and Y=3

Tom L

Code:
FNA(M,N)
BEGIN
  IF M==0 THEN
    RETURN N+1;
  END;
  IF N==0 THEN
    RETURN FNA(M-1,1);
  ELSE
    RETURN FNA(M-1,FNA(M,N-1));
  END;
END;

EXPORT ACKERMANN()
BEGIN
  WHILE 1==1 DO
    PRINT();
    INPUT({X,Y},{'X','Y'});
    MSGBOX("Ackermann= "+FNA(X,Y));
    GETKEY;
  END;
END;

Tom L
Cui bono?
Find all posts by this user
Quote this message in a reply
09-09-2016, 08:24 PM
Post: #2
RE: Calc Crash (Real and Virtual)
Well, I don't think that the calculators crashes (or I stopped that too early well, after about 10 minutes), perhaps you will have a look at the table here., which says that the deeply recursive ackerman-function should provide a(4,3)=a(3, 2^65536-3) which is bigger than the estimated amount of atoms in universe. So it should provide an overflow error at some point.
Arno
Find all posts by this user
Quote this message in a reply
09-09-2016, 10:15 PM
Post: #3
RE: Calc Crash (Real and Virtual)
(09-09-2016 08:24 PM)Arno K Wrote:  Well, I don't think that the calculators crashes (or I stopped that too early well, after about 10 minutes), perhaps you will have a look at the table here., which says that the deeply recursive ackerman-function should provide a(4,3)=a(3, 2^65536-3) which is bigger than the estimated amount of atoms in universe. So it should provide an overflow error at some point.
Arno

I know they should get an error, either overflow or out of memory or too many stack levels or something like that but they really do crash. The virtual calc exits and the real one restarts. This should never happen.

Tom L

Tom L
Cui bono?
Find all posts by this user
Quote this message in a reply
09-09-2016, 10:49 PM
Post: #4
RE: Calc Crash (Real and Virtual)
How long did it run in the VC until it exits? After 30 minutes still running on mine.
Arno
Find all posts by this user
Quote this message in a reply
09-15-2016, 10:54 AM
Post: #5
RE: Calc Crash (Real and Virtual)
Hello,

I found a bug in the program.
the input functions should have the title as the 2nd arguement, not the {'X', 'Y'} list.

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
09-15-2016, 11:48 AM
Post: #6
RE: Calc Crash (Real and Virtual)
(09-15-2016 10:54 AM)cyrille de brébisson Wrote:  Hello,

I found a bug in the program.
the input functions should have the title as the 2nd arguement, not the {'X', 'Y'} list.

Cyrille

Does not change anything, in my opinion ["Title"] means optional:
Syntax:
INPUT(var,[“title”], [“label”], [“help”], [reset_value], [initial_value])
INPUT({vars},[“titles”], [{“labels”}], [{“helps”}], [{reset_values}], [{initial_values}])
var -> {var_name, real, [{pos}]}
var -> {var_name, [allowed_types_matrix], [{pos}]}
var -> {var_name, {choose_items}, [{pos}]}

and, instead of 4 and 3, 3 and 4 runs fine.
Arno
Find all posts by this user
Quote this message in a reply
09-15-2016, 01:41 PM
Post: #7
RE: Calc Crash (Real and Virtual)
(09-15-2016 10:54 AM)cyrille de brébisson Wrote:  Hello,

I found a bug in the program.
the input functions should have the title as the 2nd arguement, not the {'X', 'Y'} list.

Cyrille

It seems to work the way it is but, of course, you know way more about how the calculator works than I do. Would the following code be better? It includes a placeholder comma.

Code:
INPUT({X,Y},,{'X','Y'});

Tom L

Tom L
Cui bono?
Find all posts by this user
Quote this message in a reply
Post Reply 




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