2022-07-15 00:09:36 +02:00
|
|
|
! Miscellaneous mathematical functions
|
2015-11-18 17:34:33 +01:00
|
|
|
module math
|
|
|
|
|
2022-07-15 00:09:36 +02:00
|
|
|
implicit none
|
2015-11-18 17:34:33 +01:00
|
|
|
|
|
|
|
contains
|
|
|
|
|
2022-07-15 00:09:36 +02:00
|
|
|
pure function fact(k)
|
2021-12-20 18:47:28 +01:00
|
|
|
! Factorial function k!
|
2022-07-15 00:09:36 +02:00
|
|
|
! Note: the result is a real number
|
|
|
|
use const_and_precisions, only : wp_
|
2021-12-20 18:47:28 +01:00
|
|
|
|
2015-11-18 17:34:33 +01:00
|
|
|
integer, intent(in) :: k
|
2021-12-20 18:47:28 +01:00
|
|
|
real(wp_) :: fact
|
2015-11-18 17:34:33 +01:00
|
|
|
|
2021-12-20 18:47:28 +01:00
|
|
|
fact = gamma(real(1 + k, kind=wp_))
|
|
|
|
end function fact
|
2015-11-18 17:34:33 +01:00
|
|
|
|
2021-12-20 18:47:28 +01:00
|
|
|
end module math
|