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 cann
2.
Work with logs of expressions.
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)
which is approximately (by changing that summation to an integral from
1..n an
Message: 4
Date: Thu, 8 Apr 2004 23:59:06 -0600
From: Dar Scott <[EMAIL PROTECTED]>
Subject: Re: range error - or "How to take the factorial of a huge
number"
To: How to use Revolution <[EMAIL PROTECTED]>
Message-ID: <[EMAIL PROTECTED]>
Content-Type: text/pla
On Friday, April 9, 2004, at 07:15 AM, Stephen Messimer wrote:
I will use the information you provided in your earlier post and see
if that works.
Didn't Jim provide some cool info?
A couple ideas:
1.
Instead of fact(200)/fact(196) do this: 197 * 198 * 199 * 200
2.
Work with logs of expression
Jim
Thanks for your help. After looking at your first response I thought
that It might be possible to combine the two sets of calculations and
sum them but as it turns out the factorial of any number > 169 results
in an overflow error so it seems doing the factorials of numbers <= 169
and t
On Thursday, April 8, 2004, at 11:05 PM, Jim Witte wrote:
This is factorial in acculator-passing-style, which is closely
related to continuation-passing-style, but I can't do the CPS in my
head,
Is this the same as tail recursion optimization?
Dar Scott
__
Type Operators *: range error (overflow)
Another possibility aside from recursion overflow (the more obvious
one - I'm missing the forrest for the trees here) is that the number is
just too big for whatever datatype MetaCard is using to represent
numbers. I don't know how you get around this
.Oh God,
Just thinking off the top of my head, I'm thinking recusion overflow
(unless the RunRev compiler automatically CPS's recursive function
automatically, which I doubt) Try this script (written off the top of
my head
function factorial (n)
return factAPS(n, 1)-- start the