Stirling's factorial approximation
parent
d88ed20a47
commit
01a811496f
|
@ -108,3 +108,12 @@ PRIVATE>
|
|||
swap -1.0 * exp
|
||||
*
|
||||
] if ;
|
||||
|
||||
! James Stirling's approximation for N!:
|
||||
! http://www.csse.monash.edu.au/~lloyd/tildeAlgDS/Numerical/Stirling/
|
||||
|
||||
: stirling-fact ( n -- fact )
|
||||
[ pi 2 * * sqrt ]
|
||||
[ dup e / swap ^ ]
|
||||
[ 12 * recip 1 + ]
|
||||
tri * * ;
|
||||
|
|
Loading…
Reference in New Issue