Go to the documentation of this file.00001
00002 FUNCTION R9GMIT (A, X, ALGAP1, SGNGAM, ALX)
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019
00020
00021
00022
00023
00024
00025
00026
00027 SAVE EPS, BOT
00028 DATA EPS, BOT / 2*0.0 /
00029
00030 IF (EPS.EQ.0.0) EPS = 0.5*R1MACH(3)
00031 IF (BOT.EQ.0.0) BOT = LOG(R1MACH(1))
00032
00033 IF (X .LE. 0.0) CALL XERMSG ('SLATEC', 'R9GMIT',
00034 + 'X SHOULD BE GT 0', 1, 2)
00035
00036 MA = A + 0.5
00037 IF (A.LT.0.0) MA = A - 0.5
00038 AEPS = A - MA
00039
00040 AE = A
00041 IF (A.LT.(-0.5)) AE = AEPS
00042
00043 T = 1.0
00044 TE = AE
00045 S = T
00046 DO 20 K=1,200
00047 FK = K
00048 TE = -X*TE/FK
00049 T = TE/(AE+FK)
00050 S = S + T
00051 IF (ABS(T).LT.EPS*ABS(S)) GO TO 30
00052 20 CONTINUE
00053 CALL XERMSG ('SLATEC', 'R9GMIT',
00054 + 'NO CONVERGENCE IN 200 TERMS OF TAYLOR-S SERIES', 2, 2)
00055
00056 30 IF (A.GE.(-0.5)) ALGS = -ALGAP1 + LOG(S)
00057 IF (A.GE.(-0.5)) GO TO 60
00058
00059 ALGS = -ALNGAM(1.0+AEPS) + LOG(S)
00060 S = 1.0
00061 M = -MA - 1
00062 IF (M.EQ.0) GO TO 50
00063 T = 1.0
00064 DO 40 K=1,M
00065 T = X*T/(AEPS-M-1+K)
00066 S = S + T
00067 IF (ABS(T).LT.EPS*ABS(S)) GO TO 50
00068 40 CONTINUE
00069
00070 50 R9GMIT = 0.0
00071 ALGS = -MA*LOG(X) + ALGS
00072 IF (S.EQ.0.0 .OR. AEPS.EQ.0.0) GO TO 60
00073
00074 SGNG2 = SGNGAM*SIGN(1.0,S)
00075 ALG2 = -X - ALGAP1 + LOG(ABS(S))
00076
00077 IF (ALG2.GT.BOT) R9GMIT = SGNG2*EXP(ALG2)
00078 IF (ALGS.GT.BOT) R9GMIT = R9GMIT + EXP(ALGS)
00079 RETURN
00080
00081 60 R9GMIT = EXP(ALGS)
00082 RETURN
00083
00084 END