! Miscellaneous mathematical functions module math implicit none contains pure function fact(k) ! Factorial function k! ! Note: the result is a real number use const_and_precisions, only : wp_ integer, intent(in) :: k real(wp_) :: fact fact = gamma(real(1 + k, kind=wp_)) end function fact end module math