HP Forums

Full Version: Recursion on the new Casio fx-CG500
You're currently viewing a stripped down version of our content. View the full version with proper formatting.
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!
(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.
Makes sense!

Namir
Reference URL's