r9lgmc.f

Go to the documentation of this file.
00001 *DECK R9LGMC
00002       FUNCTION R9LGMC (X)
00003 C***BEGIN PROLOGUE  R9LGMC
00004 C***SUBSIDIARY
00005 C***PURPOSE  Compute the log Gamma correction factor so that
00006 C            LOG(GAMMA(X)) = LOG(SQRT(2*PI)) + (X-.5)*LOG(X) - X
00007 C            + R9LGMC(X).
00008 C***LIBRARY   SLATEC (FNLIB)
00009 C***CATEGORY  C7E
00010 C***TYPE      SINGLE PRECISION (R9LGMC-S, D9LGMC-D, C9LGMC-C)
00011 C***KEYWORDS  COMPLETE GAMMA FUNCTION, CORRECTION TERM, FNLIB,
00012 C             LOG GAMMA, LOGARITHM, SPECIAL FUNCTIONS
00013 C***AUTHOR  Fullerton, W., (LANL)
00014 C***DESCRIPTION
00015 C
00016 C Compute the log gamma correction factor for X .GE. 10.0 so that
00017 C  LOG (GAMMA(X)) = LOG(SQRT(2*PI)) + (X-.5)*LOG(X) - X + R9LGMC(X)
00018 C
00019 C Series for ALGM       on the interval  0.          to  1.00000D-02
00020 C                                        with weighted error   3.40E-16
00021 C                                         log weighted error  15.47
00022 C                               significant figures required  14.39
00023 C                                    decimal places required  15.86
00024 C
00025 C***REFERENCES  (NONE)
00026 C***ROUTINES CALLED  CSEVL, INITS, R1MACH, XERMSG
00027 C***REVISION HISTORY  (YYMMDD)
00028 C   770801  DATE WRITTEN
00029 C   890531  Changed all specific intrinsics to generic.  (WRB)
00030 C   890531  REVISION DATE from Version 3.2
00031 C   891214  Prologue converted to Version 4.0 format.  (BAB)
00032 C   900315  CALLs to XERROR changed to CALLs to XERMSG.  (THJ)
00033 C   900720  Routine changed from user-callable to subsidiary.  (WRB)
00034 C***END PROLOGUE  R9LGMC
00035       DIMENSION ALGMCS(6)
00036       LOGICAL FIRST
00037       SAVE ALGMCS, NALGM, XBIG, XMAX, FIRST
00038       DATA ALGMCS( 1) /    .1666389480 45186E0 /
00039       DATA ALGMCS( 2) /   -.0000138494 817606E0 /
00040       DATA ALGMCS( 3) /    .0000000098 108256E0 /
00041       DATA ALGMCS( 4) /   -.0000000000 180912E0 /
00042       DATA ALGMCS( 5) /    .0000000000 000622E0 /
00043       DATA ALGMCS( 6) /   -.0000000000 000003E0 /
00044       DATA FIRST /.TRUE./
00045 C***FIRST EXECUTABLE STATEMENT  R9LGMC
00046       IF (FIRST) THEN
00047          NALGM = INITS (ALGMCS, 6, R1MACH(3))
00048          XBIG = 1.0/SQRT(R1MACH(3))
00049          XMAX = EXP (MIN(LOG(R1MACH(2)/12.0), -LOG(12.0*R1MACH(1))) )
00050       ENDIF
00051       FIRST = .FALSE.
00052 C
00053       IF (X .LT. 10.0) CALL XERMSG ('SLATEC', 'R9LGMC',
00054      +   'X MUST BE GE 10', 1, 2)
00055       IF (X.GE.XMAX) GO TO 20
00056 C
00057       R9LGMC = 1.0/(12.0*X)
00058       IF (X.LT.XBIG) R9LGMC = CSEVL (2.0*(10./X)**2-1., ALGMCS, NALGM)/X
00059       RETURN
00060 C
00061  20   R9LGMC = 0.0
00062       CALL XERMSG ('SLATEC', 'R9LGMC', 'X SO BIG R9LGMC UNDERFLOWS', 2,
00063      +   1)
00064       RETURN
00065 C
00066       END
 All Classes Files Functions Variables Typedefs Enumerations Enumerator Friends Defines