range error - or "How to take the factorial of a huge

Dar Scott dsc at swcp.com
Fri Apr 9 15:57:20 EDT 2004


On Friday, April 9, 2004, at 12:36 PM, Jim Witte wrote:

>   The MathWorld page on Stirling's approximation gives a formula for 
> (log n!) as well. The first formula gives an *exect* (I think) 
> derivation for ln n! as
>
> ln n! = sum(k=1..n, ln k)

This is mathematically exact, but computationally it cannot be because 
of the ln().

I was thinking (in general) that only intermediate results might be 
over the limit.  Juggling the math might help.

In the (specific-approach) ln() case, it might mean working with ln() 
in much of the math and then exp at the end of the computation.

This might also apply to the x^250 need.

Dar Scott



More information about the use-livecode mailing list