Navigation

Operators and Keywords

Function List:

C++ API

: factorial (n)

Return the factorial of n where n is a real non-negative integer.

If n is a scalar, this is equivalent to prod (1:n). For vector or matrix arguments, return the factorial of each element in the array.

For non-integers see the generalized factorial function gamma. Note that the factorial function grows large quite quickly, and even with double precision values overflow will occur if n > 171. For such cases consider gammaln.

See also: prod, gamma, gammaln.

Package: octave