Milan Babuskov wrote: > 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.
IIRC, I calculated 100,000 factorial once upon a time. A complete waste of time and CPU power, but I got the right answer. (Wrote my own 'bignum' library, in case anyone was wondering). -- Thomas Hruska CubicleSoft President Ph: 517-803-4197 *NEW* VerifyMyPC 2.1 Change tracking and management tool. Reduce tech. support times from 2 hours to 5 minutes. Free for personal use, $10 otherwise. http://www.CubicleSoft.com/VerifyMyPC/
