GNU Octave  3.8.0
A high-level interpreted language, primarily intended for numerical computations, mostly compatible with Matlab
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Pages
dgamr.f
Go to the documentation of this file.
1 *DECK DGAMR
2  DOUBLE PRECISION FUNCTION dgamr (X)
3 C***BEGIN PROLOGUE DGAMR
4 C***PURPOSE Compute the reciprocal of the Gamma function.
5 C***LIBRARY SLATEC (FNLIB)
6 C***CATEGORY C7A
7 C***TYPE DOUBLE PRECISION (GAMR-S, DGAMR-D, CGAMR-C)
8 C***KEYWORDS FNLIB, RECIPROCAL GAMMA FUNCTION, SPECIAL FUNCTIONS
9 C***AUTHOR Fullerton, W., (LANL)
10 C***DESCRIPTION
11 C
12 C DGAMR(X) calculates the double precision reciprocal of the
13 C complete Gamma function for double precision argument X.
14 C
15 C***REFERENCES (NONE)
16 C***ROUTINES CALLED DGAMMA, DLGAMS, XERCLR, XGETF, XSETF
17 C***REVISION HISTORY (YYMMDD)
18 C 770701 DATE WRITTEN
19 C 890531 Changed all specific intrinsics to generic. (WRB)
20 C 890531 REVISION DATE from Version 3.2
21 C 891214 Prologue converted to Version 4.0 format. (BAB)
22 C 900727 Added EXTERNAL statement. (WRB)
23 C***END PROLOGUE DGAMR
24  DOUBLE PRECISION x, alngx, sgngx, dgamma
25  EXTERNAL dgamma
26 C***FIRST EXECUTABLE STATEMENT DGAMR
27  dgamr = 0.0d0
28  IF (x.LE.0.0d0 .AND. aint(x).EQ.x) RETURN
29 C
30  CALL xgetf(irold)
31  CALL xsetf(1)
32  IF (abs(x).GT.10.0d0) go to 10
33  dgamr = 1.0d0/dgamma(x)
34  CALL xerclr
35  CALL xsetf(irold)
36  RETURN
37 C
38  10 CALL dlgams(x, alngx, sgngx)
39  CALL xerclr
40  CALL xsetf(irold)
41  dgamr = sgngx * exp(-alngx)
42  RETURN
43 C
44  END