Victor A. Wagner Jr. wrote: >>This wastes a lot of stack space for large numbers. > > how large a number can you get a meaningful answer.... for a 64bit long > 21 factorial won't fit > so 21 function frames isn't a LOT of stack space
Hm, you're right, I didn't think about that. I guess there are bigger problems than stack space when you try to compute, say, 100 factorial. I remember when I learned C (which was years ago) we had a task to compute something similar, and I used recursive function (just for fun) and it run out of stack space for big numbers. I thought it was factorial, but now you got me thinking and I realized it was actually Fibonacci numbers sequence. Thanks for the correction. -- Milan Babuskov http://www.guacosoft.com
