in reply to Re: Re: Factorial algorithm execution time
in thread Factorial algorithm execution time

Why do you think that truncating Stirling's series is preferable to approximating the more accurate Lanczos asymptotic series (which is valid for Re(n) > 0)? It is more 'robust' to calculate the logarithm of the gamma function because you are less prone to overflow for large values of n.
  • Comment on Re: Re: Re: Factorial algorithm execution time

Replies are listed 'Best First'.
Re: Re: Re: Re: Factorial algorithm execution time
by Anonymous Monk on Oct 27, 2002 at 16:15 UTC
    I didn't say it was preferable. I tried to explain how you can derive one of these approximations.

    As for robustness, all of the solutions presented in this discussion use big integer arithmetic. Until you run out of memory, they are precise to the last digit.