HP Forums
Recursion on the new Casio fx-CG500 - Printable Version

+- HP Forums (https://www.hpmuseum.org/forum)
+-- Forum: Not HP Calculators (/forum-7.html)
+--- Forum: Not remotely HP Calculators (/forum-9.html)
+--- Thread: Recursion on the new Casio fx-CG500 (/thread-8830.html)



Recursion on the new Casio fx-CG500 - Namir - 08-13-2017 12:54 PM

I was playing with the Casio fx-CG500 and wrote a recursive program that calculate factorials. I was a bit surprised that it failed to do 10! ... the machine displays an out-of-memory error message. I think I was able to go up to the factorial of 7. This is a disappointing limitation for a machine with 500KB RAM!


RE: Recursion on the new Casio fx-CG500 - toml_12953 - 08-13-2017 10:16 PM

(08-13-2017 12:54 PM)Namir Wrote:  I was playing with the Casio fx-CG500 and wrote a recursive program that calculate factorials. I was a bit surprised that it failed to do 10! ... the machine displays an out-of-memory error message. I think I was able to go up to the factorial of 7. This is a disappointing limitation for a machine with 500KB RAM!

Most likely, there's a fixed-size return stack that gets filled long before all of memory gets filled. That's unlike a PC where the return stack is limited only by the size of free memory.


RE: Recursion on the new Casio fx-CG500 - Namir - 08-14-2017 08:23 AM

Makes sense!

Namir