Welcome to the Harris Geospatial product documentation center. Here you will find reference guides, help documents, and product libraries.


FACTORIAL

FACTORIAL

The FACTORIAL function computes the factorial N! For integers, the factorial is computed as (N) • (N – 1) • (– 2) • ... • 3 • 2 • 1. For non-integers the factorial is computed using GAMMA( N+1 ).

This routine is written in the IDL language. Its source code can be found in the file factorial.pro in the lib subdirectory of the IDL distribution.

Examples


Compute 20!:

PRINT, FACTORIAL(20)

IDL prints:

2.4329020e+18

Syntax


Result = FACTORIAL( N [, /STIRLING] [, /UL64] )

Return Value


Returns the product of the non-negative scalar value or array of values.

Arguments


N

A non-negative scalar or array of values.

Note: Large values of N will cause floating-point overflow errors. The maximum size of N varies with machine architecture. On machines that support the IEEE standard for floating-point arithmetic, the maximum value of N is 170. See MACHAR for a discussion of machine-specific parameters affecting floating-point arithmetic.

Keywords


STIRLING

Set this keyword to use Stirling’s asymptotic formula to approximate N!:

where e is the base of the natural logarithm.

UL64

Set this keyword to return the results as unsigned 64-bit integers. This keyword is ignored if STIRLING is set.

Note: Unsigned 64-bit integers will overflow for values of N greater than 20.

Version History


Pre 4.0

Introduced

See Also


BINOMIAL, TOTAL



© 2017 Exelis Visual Information Solutions, Inc. |  Legal
My Account    |    Buy    |    Contact Us