You are currently viewing the gmlscripts.pro static mirror. Forum access and script submissions are not available through this mirror.

Invert gmlscripts.pro

factorial

NOTE: 21! is the largest factorial GameMaker:Studio can precisely compute. Beyond that, floating point arithmetic can represent factorials as large as 170! with decreasing precision.

factorial(number)
Returns the factorial of a given number.
COPY/// factorial(number)
//
//  Returns the factorial of a given number.
//
//      number      value, integer
//
//  Note: 21! is the largest factorial GameMaker:Studio can precisely
//  compute. Beyond that, floating-point arithmetic can represent 
//  factorials as large as 170! with decreasing precision.
//
/// gmlscripts.pro/license
{
    if (argument0 <= 1) return 1;
    else return argument0 * factorial(argument0 - 1);
}

Contributors: xot

GitHub: View · Commits · Blame · Raw