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
gamr.f
Go to the documentation of this file.
1 *DECK GAMR
2  FUNCTION gamr (X)
3 C***BEGIN PROLOGUE GAMR
4 C***PURPOSE Compute the reciprocal of the Gamma function.
5 C***LIBRARY SLATEC (FNLIB)
6 C***CATEGORY C7A
7 C***TYPE SINGLE 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 GAMR is a single precision function that evaluates the reciprocal
13 C of the gamma function for single precision argument X.
14 C
15 C***REFERENCES (NONE)
16 C***ROUTINES CALLED ALGAMS, GAMMA, XERCLR, XGETF, XSETF
17 C***REVISION HISTORY (YYMMDD)
18 C 770701 DATE WRITTEN
19 C 861211 REVISION DATE from Version 3.2
20 C 891214 Prologue converted to Version 4.0 format. (BAB)
21 C 900727 Added EXTERNAL statement. (WRB)
22 C***END PROLOGUE GAMR
23  EXTERNAL gamma
24 C***FIRST EXECUTABLE STATEMENT GAMR
25  gamr = 0.0
26  IF (x.LE.0.0 .AND. aint(x).EQ.x) RETURN
27 C
28  CALL xgetf(irold)
29  CALL xsetf(1)
30  IF (abs(x).GT.10.0) go to 10
31  gamr = 1.0/gamma(x)
32  CALL xerclr
33  CALL xsetf(irold)
34  RETURN
35 C
36  10 CALL algams(x, alngx, sgngx)
37  CALL xerclr
38  CALL xsetf(irold)
39  gamr = sgngx * exp(-alngx)
40  RETURN
41 C
42  END