]> git.uio.no Git - u/mrichter/AliRoot.git/blame - ISAJET/code/dincgm.F
EffC++ warnings corrected.
[u/mrichter/AliRoot.git] / ISAJET / code / dincgm.F
CommitLineData
0795afa3 1#include "isajet/pilot.h"
2 DOUBLE PRECISION FUNCTION DINCGM(A,X,EPS)
3C***********************************************************************
4C* Series expansion of incomplete gamma function, from Abramowitz and *
5C* Stegun. A and X are the two arguments, while EPS is the relative *
6C* precision. More accurately, if X > 0, EPS is the ratio of the last *
7C* term in the series and the sum; note that for X > 0, the series is *
8C* alternating. For X < 0, this ratio is required to be < EPS/100. *
9C***********************************************************************
10
11 DOUBLE PRECISION A,X,EPS,SUM,TERM,XN
12C IF(DABS(A).LT.1.D-10) THEN
13C WRITE(*,*) ' Function diverges for A = 0!'
14C DINCGM = 1.D50
15C RETURN
16C ENDIF
17 SUM = 1.D0/A
18 TERM = 1.D0 !Term for n = 0
19 H = 1.D0
20 XN = 1.D0
21
22 1 H = -H*X/XN
23 TERM = H/(A+XN)
24 XN = XN+1.D0
25 SUM = SUM+TERM
26 IF((DABS(TERM/SUM).GT.EPS.AND.X.GE.0.D0).OR.
27 & (DABS(TERM/SUM).GT.1.D-2*EPS.AND.X.LE.0.D0)) GOTO 1
28
29 DINCGM = SUM*(X**A)
30 RETURN
31 END