factorial Function

public pure function factorial(n) result(res)

Factorial of integer n; wrapper around intrinsic gamma function. Output is real to increase overflow threshold. For overflow case, result = Infinity; for n < 0, result = NaN.

Arguments

Type IntentOptional Attributes Name
integer, intent(in) :: n

Integer to take the factorial of

Return Value real(kind=fp)