, via (the intrinsic
LOG_GAMMA). Used throughout CGCOEFF, SSH, and
ASSOC_LEGENDRE to evaluate factorial ratios like
as
without overflowing the individual factorials for large .
Returns: .
| Type | Intent | Optional | Attributes | Name | ||
|---|---|---|---|---|---|---|
| integer(kind=i4), | intent(in) | :: | N |
Non-negative integer argument ( returns 0). |
FUNCTION LOG_FACT_DP(N) RESULT(LOG_FACT) IMPLICIT NONE INTEGER(KIND=i4), INTENT(IN) :: N REAL(KIND=dp) :: LOG_FACT IF (N <= 1) THEN LOG_FACT = 0.0_dp ELSE ! ln(n!) = ln(Gamma(n+1)) LOG_FACT = LOG_GAMMA(REAL(N + 1, KIND=dp)) END IF END FUNCTION LOG_FACT_DP