The TELEMAC-MASCARET system  trunk
bief_gammln.f
Go to the documentation of this file.
1 ! *************************************
2  DOUBLE PRECISION FUNCTION bief_gammln
3 ! *************************************
4 !
5  &(xx)
6 !
7 !***********************************************************************
8 ! BIEF V6P3 07/03/2013
9 !***********************************************************************
10 !
11 !brief Returns the value ln(gamma(xx) for xx > 0) Full accuracy is
12 !+ obtained for xx > 1.
13 !
14 !history D J Evans-Roberts (HRW)
15 !+ 23/11/1993
16 !+ V6P3
17 !+ First version sent by Michiel Knaapen (HRW) on 07/03/2013.
18 !
19 !~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
20 !| XX |-->| OPERAND
21 !~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
22 !
23 ! USE BIEF
24 !
26  IMPLICIT NONE
27 !
28 !+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
29 !
30  DOUBLE PRECISION, INTENT(IN) :: XX
31 !
32 !+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
33 !
34  INTEGER J
35  DOUBLE PRECISION :: COF(6),STP,HALF,ONE,FPF,X,TMP,SER
36  parameter( cof = (/ 76.18009173d0,-86.50532033d0,24.01409822d0,
37  & -1.231739516d0,0.120858003d-2,-0.536382d-5 /) )
38  parameter( stp = 2.506628727465d0 )
39  parameter( half = 0.5d0, one = 1.d0, fpf = 5.5d0 )
40 !
41  INTRINSIC log
42 !
43 !-----------------------------------------------------------------------
44 !
45  x = xx - one
46  tmp = x + fpf
47  tmp = (x+half)*log(tmp) - tmp
48  ser = one
49 !
50  DO j = 1,6
51  x = x + one
52  ser = ser + cof(j)/x
53  ENDDO
54 !
55  bief_gammln = tmp + log(stp*ser)
56 !
57 !-----------------------------------------------------------------------
58 !
59  RETURN
60  END
double precision function bief_gammln(XX)
Definition: bief_gammln.f:7