2 SUBROUTINE dpsifn (X, N, KODE, M, ANS, NZ, IERR)
109 INTEGER I, IERR, J, K, KODE, M, MM, MX, N, NMAX, NN, NP, NX, NZ,
112 DOUBLE PRECISION ANS, ARG, B, DEN, ELIM, EPS, FLN,
113 * FX, RLN, RXSQ, R1M4, R1M5, S, SLOPE, T, TA, TK, TOL, TOLS, TRM,
114 * TRMR, TSS, TST, TT, T1, T2, WDTOL, X, XDMLN, XDMY, XINC, XLN,
116 DOUBLE PRECISION D1MACH
117 dimension b(22), trm(22), trmr(100), ans(*)
123 DATA b(1), b(2), b(3), b(4), b(5), b(6), b(7), b(8), b(9), b(10),
124 * b(11), b(12), b(13), b(14), b(15), b(16), b(17), b(18), b(19),
125 * b(20), b(21), b(22) /1.00000000000000000d+00,
126 * -5.00000000000000000d-01,1.66666666666666667d-01,
127 * -3.33333333333333333d-02,2.38095238095238095d-02,
128 * -3.33333333333333333d-02,7.57575757575757576d-02,
129 * -2.53113553113553114d-01,1.16666666666666667d+00,
130 * -7.09215686274509804d+00,5.49711779448621554d+01,
131 * -5.29124242424242424d+02,6.19212318840579710d+03,
132 * -8.65802531135531136d+04,1.42551716666666667d+06,
133 * -2.72982310678160920d+07,6.01580873900642368d+08,
134 * -1.51163157670921569d+10,4.29614643061166667d+11,
135 * -1.37116552050883328d+13,4.88332318973593167d+14,
136 * -1.92965793419400681d+16/
141 IF (x.LE.0.0d0) ierr=1
143 IF (kode.LT.1 .OR. kode.GT.2) ierr=1
145 IF (ierr.NE.0)
RETURN
147 nx =
min(-i1mach(15),i1mach(16))
149 r1m4 = d1mach(4)*0.5d0
150 wdtol =
max(r1m4,0.5d-18)
154 elim = 2.302d0*(nx*r1m5-3.0d0)
163 IF (abs(t).GT.elim)
GO TO 290
164 IF (x.LT.wdtol)
GO TO 260
168 rln = r1m5*i1mach(14)
169 rln =
min(rln,18.06d0)
170 fln =
max(rln,3.0d0) - 3.0d0
171 yint = 3.50d0 + 0.40d0*fln
172 slope = 0.21d0 + fln*(0.0006038d0*fln+0.008677d0)
177 xm = -2.302d0*rln -
min(0.0d0,xln)
182 IF (abs(arg).LT.1.0d-3) xm = -arg
185 IF (xm.GT.7.0d0 .AND. fln.LT.15.0d0)
GO TO 200
190 IF (x.GE.xmin)
GO TO 60
202 tk =
max(abs(t),abs(t1),abs(t2))
203 IF (tk.GT.elim)
GO TO 380
208 IF (nn.NE.0) t1 = tt + 1.0d0/fn
209 rxsq = 1.0d0/(xdmy*xdmy)
213 IF (abs(s).LT.tst)
GO TO 80
216 t = t*((tk+fn+1)/(tk+1.0d0))*((tk+fn)/(tk+2.0d0))*rxsq
218 IF (abs(trm(k)).LT.tst)
GO TO 80
224 IF (xinc.EQ.0.0d0)
GO TO 100
230 IF (nx.GT.nmax)
GO TO 390
231 IF (nn.EQ.0)
GO TO 160
245 IF (fn.EQ.0)
GO TO 180
254 IF (fn.NE.0) t1 = tt + 1.0d0/fn
257 IF (abs(s).LT.tst)
GO TO 120
260 trm(k) = trm(k)*(fn+1)/tk
261 IF (abs(trm(k)).LT.tst)
GO TO 120
267 IF (xinc.EQ.0.0d0)
GO TO 140
268 IF (fn.EQ.0)
GO TO 160
280 IF (fn.EQ.0)
GO TO 180
288 s = s + 1.0d0/(x+nx-i)
291 IF (kode.EQ.2)
GO TO 190
295 IF (xdmy.EQ.x)
RETURN
315 IF (n.NE.0)
GO TO 220
316 IF (kode.EQ.2) ans(1) = s + xln
332 IF (trm(i).LT.tols)
GO TO 240
343 IF (mm.EQ.1)
GO TO 280
351 IF (kode.EQ.2) ans(1) = ans(1) + xln
354 IF (t.GT.0.0d0)
GO TO 380
charNDArray max(char d, const charNDArray &m)
charNDArray min(char d, const charNDArray &m)
subroutine dpsifn(X, N, KODE, M, ANS, NZ, IERR)