FACTORIAL_DP Function

private function FACTORIAL_DP(K) result(FACTORIAL)

Factorial for , computed by direct multiplication.

Returns: as a double-precision real (avoids integer overflow for moderate K; see LOG_FACT for large-K stability).

Arguments

Type IntentOptional Attributes Name
integer(kind=i4), intent(in) :: K

Non-negative integer argument.

Return Value real(kind=dp)


Called by

proc~~factorial_dp~~CalledByGraph proc~factorial_dp FACTORIAL_DP interface~factorial FACTORIAL interface~factorial->proc~factorial_dp

Source Code

  FUNCTION FACTORIAL_DP(K) RESULT(FACTORIAL)
  IMPLICIT NONE
  INTEGER(KIND=i4), INTENT(IN) :: K
  REAL(KIND=dp) :: FACTORIAL
  INTEGER(KIND=i4) :: I
  FACTORIAL = 1.0d0
  DO I = 1,K
      FACTORIAL = I * FACTORIAL
  END DO
  RETURN
  END FUNCTION FACTORIAL_DP