HP Forums
Calc Crash (Real and Virtual) - Printable Version

+- HP Forums (https://www.hpmuseum.org/forum)
+-- Forum: HP Calculators (and very old HP Computers) (/forum-3.html)
+--- Forum: HP Prime (/forum-5.html)
+--- Thread: Calc Crash (Real and Virtual) (/thread-6820.html)



Calc Crash (Real and Virtual) - toml_12953 - 09-09-2016 07:26 PM

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;



RE: Calc Crash (Real and Virtual) - Arno K - 09-09-2016 08:24 PM

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


RE: Calc Crash (Real and Virtual) - toml_12953 - 09-09-2016 10:15 PM

(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


RE: Calc Crash (Real and Virtual) - Arno K - 09-09-2016 10:49 PM

How long did it run in the VC until it exits? After 30 minutes still running on mine.
Arno


RE: Calc Crash (Real and Virtual) - cyrille de brébisson - 09-15-2016 10:54 AM

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


RE: Calc Crash (Real and Virtual) - Arno K - 09-15-2016 11:48 AM

(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


RE: Calc Crash (Real and Virtual) - toml_12953 - 09-15-2016 01:41 PM

(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