specfun 1.0.8__tar.gz

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (51) hide show
  1. specfun-1.0.8/.nativegate/build/algama.f +283 -0
  2. specfun-1.0.8/.nativegate/build/daw.f +260 -0
  3. specfun-1.0.8/.nativegate/build/ei.f +508 -0
  4. specfun-1.0.8/.nativegate/build/erf.f +337 -0
  5. specfun-1.0.8/.nativegate/build/gamma.f +251 -0
  6. specfun-1.0.8/.nativegate/build/i0.f +269 -0
  7. specfun-1.0.8/.nativegate/build/i1.f +272 -0
  8. specfun-1.0.8/.nativegate/build/k0.f +281 -0
  9. specfun-1.0.8/.nativegate/build/k1.f +273 -0
  10. specfun-1.0.8/.nativegate/build/meson.build +75 -0
  11. specfun-1.0.8/.nativegate/build/psi.f +261 -0
  12. specfun-1.0.8/.nativegate/build/ren.f +38 -0
  13. specfun-1.0.8/.nativegate/build/specfun-f2pywrappers.f +129 -0
  14. specfun-1.0.8/.nativegate/build/specfunmodule.c +1517 -0
  15. specfun-1.0.8/.nativegate/ir.json +365 -0
  16. specfun-1.0.8/CMakeLists.txt +67 -0
  17. specfun-1.0.8/PKG-INFO +31 -0
  18. specfun-1.0.8/README.md +19 -0
  19. specfun-1.0.8/golden.json +231 -0
  20. specfun-1.0.8/native/_expanded/algama.f +283 -0
  21. specfun-1.0.8/native/_expanded/daw.f +260 -0
  22. specfun-1.0.8/native/_expanded/ei.f +508 -0
  23. specfun-1.0.8/native/_expanded/erf.f +337 -0
  24. specfun-1.0.8/native/_expanded/gamma.f +251 -0
  25. specfun-1.0.8/native/_expanded/i0.f +269 -0
  26. specfun-1.0.8/native/_expanded/i1.f +272 -0
  27. specfun-1.0.8/native/_expanded/k0.f +281 -0
  28. specfun-1.0.8/native/_expanded/k1.f +273 -0
  29. specfun-1.0.8/native/_expanded/psi.f +261 -0
  30. specfun-1.0.8/native/_expanded/ren.f +38 -0
  31. specfun-1.0.8/native/algama.f +284 -0
  32. specfun-1.0.8/native/daw.f +260 -0
  33. specfun-1.0.8/native/ei.f +508 -0
  34. specfun-1.0.8/native/erf.f +337 -0
  35. specfun-1.0.8/native/gamma.f +251 -0
  36. specfun-1.0.8/native/i0.f +269 -0
  37. specfun-1.0.8/native/i1.f +272 -0
  38. specfun-1.0.8/native/k0.f +281 -0
  39. specfun-1.0.8/native/k1.f +273 -0
  40. specfun-1.0.8/native/psi.f +261 -0
  41. specfun-1.0.8/native/ren.f +38 -0
  42. specfun-1.0.8/nativegate.yaml +19 -0
  43. specfun-1.0.8/pyproject.toml +14 -0
  44. specfun-1.0.8/python/specfun/__init__.py +4 -0
  45. specfun-1.0.8/python/specfun/mcp_server.py +114 -0
  46. specfun-1.0.8/python/specfun/middleware.py +648 -0
  47. specfun-1.0.8/python/specfun/router.py +328 -0
  48. specfun-1.0.8/python/specfun/service.py +76 -0
  49. specfun-1.0.8/tests/test_golden.py +248 -0
  50. specfun-1.0.8/tests/test_mcp.py +46 -0
  51. specfun-1.0.8/tests/test_python_api.py +72 -0
@@ -0,0 +1,283 @@
1
+ C REAL FUNCTION ALGAMA(X)
2
+ DOUBLE PRECISION FUNCTION DLGAMA(X)
3
+ C----------------------------------------------------------------------
4
+ C
5
+ C This routine calculates the LOG(GAMMA) function for a positive real
6
+ C argument X. Computation is based on an algorithm outlined in
7
+ C references 1 and 2. The program uses rational functions that
8
+ C theoretically approximate LOG(GAMMA) to at least 18 significant
9
+ C decimal digits. The approximation for X > 12 is from reference
10
+ C 3, while approximations for X < 12.0 are similar to those in
11
+ C reference 1, but are unpublished. The accuracy achieved depends
12
+ C on the arithmetic system, the compiler, the intrinsic functions,
13
+ C and proper selection of the machine-dependent constants.
14
+ C
15
+ C
16
+ C*********************************************************************
17
+ C*********************************************************************
18
+ C
19
+ C Explanation of machine-dependent constants
20
+ C
21
+ C beta - radix for the floating-point representation
22
+ C maxexp - the smallest positive power of beta that overflows
23
+ C XBIG - largest argument for which LN(GAMMA(X)) is representable
24
+ C in the machine, i.e., the solution to the equation
25
+ C LN(GAMMA(XBIG)) = beta**maxexp
26
+ C XINF - largest machine representable floating-point number;
27
+ C approximately beta**maxexp.
28
+ C EPS - The smallest positive floating-point number such that
29
+ C 1.0+EPS .GT. 1.0
30
+ C FRTBIG - Rough estimate of the fourth root of XBIG
31
+ C
32
+ C
33
+ C Approximate values for some important machines are:
34
+ C
35
+ C beta maxexp XBIG
36
+ C
37
+ C CRAY-1 (S.P.) 2 8191 9.62E+2461
38
+ C Cyber 180/855
39
+ C under NOS (S.P.) 2 1070 1.72E+319
40
+ C IEEE (IBM/XT,
41
+ C SUN, etc.) (S.P.) 2 128 4.08E+36
42
+ C IEEE (IBM/XT,
43
+ C SUN, etc.) (D.P.) 2 1024 2.55D+305
44
+ C IBM 3033 (D.P.) 16 63 4.29D+73
45
+ C VAX D-Format (D.P.) 2 127 2.05D+36
46
+ C VAX G-Format (D.P.) 2 1023 1.28D+305
47
+ C
48
+ C
49
+ C XINF EPS FRTBIG
50
+ C
51
+ C CRAY-1 (S.P.) 5.45E+2465 7.11E-15 3.13E+615
52
+ C Cyber 180/855
53
+ C under NOS (S.P.) 1.26E+322 3.55E-15 6.44E+79
54
+ C IEEE (IBM/XT,
55
+ C SUN, etc.) (S.P.) 3.40E+38 1.19E-7 1.42E+9
56
+ C IEEE (IBM/XT,
57
+ C SUN, etc.) (D.P.) 1.79D+308 2.22D-16 2.25D+76
58
+ C IBM 3033 (D.P.) 7.23D+75 2.22D-16 2.56D+18
59
+ C VAX D-Format (D.P.) 1.70D+38 1.39D-17 1.20D+9
60
+ C VAX G-Format (D.P.) 8.98D+307 1.11D-16 1.89D+76
61
+ C
62
+ C**************************************************************
63
+ C**************************************************************
64
+ C
65
+ C Error returns
66
+ C
67
+ C The program returns the value XINF for X .LE. 0.0 or when
68
+ C overflow would occur. The computation is believed to
69
+ C be free of underflow and overflow.
70
+ C
71
+ C
72
+ C Intrinsic functions required are:
73
+ C
74
+ C LOG
75
+ C
76
+ C
77
+ C References:
78
+ C
79
+ C 1) W. J. Cody and K. E. Hillstrom, 'Chebyshev Approximations for
80
+ C the Natural Logarithm of the Gamma Function,' Math. Comp. 21,
81
+ C 1967, pp. 198-203.
82
+ C
83
+ C 2) K. E. Hillstrom, ANL/AMD Program ANLC366S, DGAMMA/DLGAMA, May,
84
+ C 1969.
85
+ C
86
+ C 3) Hart, Et. Al., Computer Approximations, Wiley and sons, New
87
+ C York, 1968.
88
+ C
89
+ C
90
+ C Authors: W. J. Cody and L. Stoltz
91
+ C Argonne National Laboratory
92
+ C
93
+ C Latest modification: June 16, 1988
94
+ C
95
+ C----------------------------------------------------------------------
96
+ INTEGER I
97
+ C REAL
98
+ DOUBLE PRECISION
99
+ 1 C,CORR,D1,D2,D4,EPS,FRTBIG,FOUR,HALF,ONE,PNT68,P1,P2,P4,
100
+ 2 Q1,Q2,Q4,RES,SQRTPI,THRHAL,TWELVE,TWO,X,XBIG,XDEN,XINF,
101
+ 3 XM1,XM2,XM4,XNUM,Y,YSQ,ZERO
102
+ DIMENSION C(7),P1(8),P2(8),P4(8),Q1(8),Q2(8),Q4(8)
103
+ C----------------------------------------------------------------------
104
+ C Mathematical constants
105
+ C----------------------------------------------------------------------
106
+ C DATA ONE,HALF,TWELVE,ZERO/1.0E0,0.5E0,12.0E0,0.0E0/,
107
+ C 1 FOUR,THRHAL,TWO,PNT68/4.0E0,1.5E0,2.0E0,0.6796875E0/,
108
+ C 2 SQRTPI/0.9189385332046727417803297E0/
109
+ DATA ONE,HALF,TWELVE,ZERO/1.0D0,0.5D0,12.0D0,0.0D0/,
110
+ 1 FOUR,THRHAL,TWO,PNT68/4.0D0,1.5D0,2.0D0,0.6796875D0/,
111
+ 2 SQRTPI/0.9189385332046727417803297D0/
112
+ C----------------------------------------------------------------------
113
+ C Machine dependent parameters
114
+ C----------------------------------------------------------------------
115
+ C DATA XBIG,XINF,EPS,FRTBIG/4.08E36,3.401E38,1.19E-7,1.42E9/
116
+ DATA XBIG,XINF,EPS,FRTBIG/2.55D305,1.79D308,2.22D-16,2.25D76/
117
+ C----------------------------------------------------------------------
118
+ C Numerator and denominator coefficients for rational minimax
119
+ C approximation over (0.5,1.5).
120
+ C----------------------------------------------------------------------
121
+ C DATA D1/-5.772156649015328605195174E-1/
122
+ C DATA P1/4.945235359296727046734888E0,2.018112620856775083915565E2,
123
+ C 1 2.290838373831346393026739E3,1.131967205903380828685045E4,
124
+ C 2 2.855724635671635335736389E4,3.848496228443793359990269E4,
125
+ C 3 2.637748787624195437963534E4,7.225813979700288197698961E3/
126
+ C DATA Q1/6.748212550303777196073036E1,1.113332393857199323513008E3,
127
+ C 1 7.738757056935398733233834E3,2.763987074403340708898585E4,
128
+ C 2 5.499310206226157329794414E4,6.161122180066002127833352E4,
129
+ C 3 3.635127591501940507276287E4,8.785536302431013170870835E3/
130
+ DATA D1/-5.772156649015328605195174D-1/
131
+ DATA P1/4.945235359296727046734888D0,2.018112620856775083915565D2,
132
+ 1 2.290838373831346393026739D3,1.131967205903380828685045D4,
133
+ 2 2.855724635671635335736389D4,3.848496228443793359990269D4,
134
+ 3 2.637748787624195437963534D4,7.225813979700288197698961D3/
135
+ DATA Q1/6.748212550303777196073036D1,1.113332393857199323513008D3,
136
+ 1 7.738757056935398733233834D3,2.763987074403340708898585D4,
137
+ 2 5.499310206226157329794414D4,6.161122180066002127833352D4,
138
+ 3 3.635127591501940507276287D4,8.785536302431013170870835D3/
139
+ C----------------------------------------------------------------------
140
+ C Numerator and denominator coefficients for rational minimax
141
+ C Approximation over (1.5,4.0).
142
+ C----------------------------------------------------------------------
143
+ C DATA D2/4.227843350984671393993777E-1/
144
+ C DATA P2/4.974607845568932035012064E0,5.424138599891070494101986E2,
145
+ C 1 1.550693864978364947665077E4,1.847932904445632425417223E5,
146
+ C 2 1.088204769468828767498470E6,3.338152967987029735917223E6,
147
+ C 3 5.106661678927352456275255E6,3.074109054850539556250927E6/
148
+ C DATA Q2/1.830328399370592604055942E2,7.765049321445005871323047E3,
149
+ C 1 1.331903827966074194402448E5,1.136705821321969608938755E6,
150
+ C 2 5.267964117437946917577538E6,1.346701454311101692290052E7,
151
+ C 3 1.782736530353274213975932E7,9.533095591844353613395747E6/
152
+ DATA D2/4.227843350984671393993777D-1/
153
+ DATA P2/4.974607845568932035012064D0,5.424138599891070494101986D2,
154
+ 1 1.550693864978364947665077D4,1.847932904445632425417223D5,
155
+ 2 1.088204769468828767498470D6,3.338152967987029735917223D6,
156
+ 3 5.106661678927352456275255D6,3.074109054850539556250927D6/
157
+ DATA Q2/1.830328399370592604055942D2,7.765049321445005871323047D3,
158
+ 1 1.331903827966074194402448D5,1.136705821321969608938755D6,
159
+ 2 5.267964117437946917577538D6,1.346701454311101692290052D7,
160
+ 3 1.782736530353274213975932D7,9.533095591844353613395747D6/
161
+ C----------------------------------------------------------------------
162
+ C Numerator and denominator coefficients for rational minimax
163
+ C Approximation over (4.0,12.0).
164
+ C----------------------------------------------------------------------
165
+ C DATA D4/1.791759469228055000094023E0/
166
+ C DATA P4/1.474502166059939948905062E4,2.426813369486704502836312E6,
167
+ C 1 1.214755574045093227939592E8,2.663432449630976949898078E9,
168
+ C 2 2.940378956634553899906876E10,1.702665737765398868392998E11,
169
+ C 3 4.926125793377430887588120E11,5.606251856223951465078242E11/
170
+ C DATA Q4/2.690530175870899333379843E3,6.393885654300092398984238E5,
171
+ C 2 4.135599930241388052042842E7,1.120872109616147941376570E9,
172
+ C 3 1.488613728678813811542398E10,1.016803586272438228077304E11,
173
+ C 4 3.417476345507377132798597E11,4.463158187419713286462081E11/
174
+ DATA D4/1.791759469228055000094023D0/
175
+ DATA P4/1.474502166059939948905062D4,2.426813369486704502836312D6,
176
+ 1 1.214755574045093227939592D8,2.663432449630976949898078D9,
177
+ 2 2.940378956634553899906876D10,1.702665737765398868392998D11,
178
+ 3 4.926125793377430887588120D11,5.606251856223951465078242D11/
179
+ DATA Q4/2.690530175870899333379843D3,6.393885654300092398984238D5,
180
+ 2 4.135599930241388052042842D7,1.120872109616147941376570D9,
181
+ 3 1.488613728678813811542398D10,1.016803586272438228077304D11,
182
+ 4 3.417476345507377132798597D11,4.463158187419713286462081D11/
183
+ C----------------------------------------------------------------------
184
+ C Coefficients for minimax approximation over (12, INF).
185
+ C----------------------------------------------------------------------
186
+ C DATA C/-1.910444077728E-03,8.4171387781295E-04,
187
+ C 1 -5.952379913043012E-04,7.93650793500350248E-04,
188
+ C 2 -2.777777777777681622553E-03,8.333333333333333331554247E-02,
189
+ C 3 5.7083835261E-03/
190
+ DATA C/-1.910444077728D-03,8.4171387781295D-04,
191
+ 1 -5.952379913043012D-04,7.93650793500350248D-04,
192
+ 2 -2.777777777777681622553D-03,8.333333333333333331554247D-02,
193
+ 3 5.7083835261D-03/
194
+ C----------------------------------------------------------------------
195
+ Y = X
196
+ IF ((Y .GT. ZERO) .AND. (Y .LE. XBIG)) THEN
197
+ IF (Y .LE. EPS) THEN
198
+ RES = -LOG(Y)
199
+ ELSE IF (Y .LE. THRHAL) THEN
200
+ C----------------------------------------------------------------------
201
+ C EPS .LT. X .LE. 1.5
202
+ C----------------------------------------------------------------------
203
+ IF (Y .LT. PNT68) THEN
204
+ CORR = -LOG(Y)
205
+ XM1 = Y
206
+ ELSE
207
+ CORR = ZERO
208
+ XM1 = (Y - HALF) - HALF
209
+ END IF
210
+ IF ((Y .LE. HALF) .OR. (Y .GE. PNT68)) THEN
211
+ XDEN = ONE
212
+ XNUM = ZERO
213
+ DO 140 I = 1, 8
214
+ XNUM = XNUM*XM1 + P1(I)
215
+ XDEN = XDEN*XM1 + Q1(I)
216
+ 140 CONTINUE
217
+ RES = CORR + (XM1 * (D1 + XM1*(XNUM/XDEN)))
218
+ ELSE
219
+ XM2 = (Y - HALF) - HALF
220
+ XDEN = ONE
221
+ XNUM = ZERO
222
+ DO 220 I = 1, 8
223
+ XNUM = XNUM*XM2 + P2(I)
224
+ XDEN = XDEN*XM2 + Q2(I)
225
+ 220 CONTINUE
226
+ RES = CORR + XM2 * (D2 + XM2*(XNUM/XDEN))
227
+ END IF
228
+ ELSE IF (Y .LE. FOUR) THEN
229
+ C----------------------------------------------------------------------
230
+ C 1.5 .LT. X .LE. 4.0
231
+ C----------------------------------------------------------------------
232
+ XM2 = Y - TWO
233
+ XDEN = ONE
234
+ XNUM = ZERO
235
+ DO 240 I = 1, 8
236
+ XNUM = XNUM*XM2 + P2(I)
237
+ XDEN = XDEN*XM2 + Q2(I)
238
+ 240 CONTINUE
239
+ RES = XM2 * (D2 + XM2*(XNUM/XDEN))
240
+ ELSE IF (Y .LE. TWELVE) THEN
241
+ C----------------------------------------------------------------------
242
+ C 4.0 .LT. X .LE. 12.0
243
+ C----------------------------------------------------------------------
244
+ XM4 = Y - FOUR
245
+ XDEN = -ONE
246
+ XNUM = ZERO
247
+ DO 340 I = 1, 8
248
+ XNUM = XNUM*XM4 + P4(I)
249
+ XDEN = XDEN*XM4 + Q4(I)
250
+ 340 CONTINUE
251
+ RES = D4 + XM4*(XNUM/XDEN)
252
+ ELSE
253
+ C----------------------------------------------------------------------
254
+ C Evaluate for argument .GE. 12.0,
255
+ C----------------------------------------------------------------------
256
+ RES = ZERO
257
+ IF (Y .LE. FRTBIG) THEN
258
+ RES = C(7)
259
+ YSQ = Y * Y
260
+ DO 450 I = 1, 6
261
+ RES = RES / YSQ + C(I)
262
+ 450 CONTINUE
263
+ END IF
264
+ RES = RES/Y
265
+ CORR = LOG(Y)
266
+ RES = RES + SQRTPI - HALF*CORR
267
+ RES = RES + Y*(CORR-ONE)
268
+ END IF
269
+ ELSE
270
+ C----------------------------------------------------------------------
271
+ C Return for bad arguments
272
+ C----------------------------------------------------------------------
273
+ RES = XINF
274
+ END IF
275
+ C----------------------------------------------------------------------
276
+ C Final adjustments and return
277
+ C----------------------------------------------------------------------
278
+ C ALGAMA = RES
279
+ DLGAMA = RES
280
+ RETURN
281
+ C ---------- Last line of DLGAMA ----------
282
+ END
283
+
@@ -0,0 +1,260 @@
1
+ FUNCTION DAW(XX)
2
+ C----------------------------------------------------------------------
3
+ C
4
+ C This function program evaluates Dawson's integral,
5
+ C
6
+ C 2 / x 2
7
+ C -x | t
8
+ C F(x) = e | e dt
9
+ C |
10
+ C / 0
11
+ C
12
+ C for a real argument x.
13
+ C
14
+ C The calling sequence for this function is
15
+ C
16
+ C Y=DAW(X)
17
+ C
18
+ C The main computation uses rational Chebyshev approximations
19
+ C published in Math. Comp. 24, 171-178 (1970) by Cody, Paciorek
20
+ C and Thacher. This transportable program is patterned after the
21
+ C machine-dependent FUNPACK program DDAW(X), but cannot match that
22
+ C version for efficiency or accuracy. This version uses rational
23
+ C approximations that are theoretically accurate to about 19
24
+ C significant decimal digits. The accuracy achieved depends on the
25
+ C arithmetic system, the compiler, the intrinsic functions, and
26
+ C proper selection of the machine-dependent constants.
27
+ C
28
+ C*******************************************************************
29
+ C*******************************************************************
30
+ C
31
+ C Explanation of machine-dependent constants
32
+ C
33
+ C XINF = largest positive machine number
34
+ C XMIN = the smallest positive machine number.
35
+ C EPS = smallest positive number such that 1+eps > 1.
36
+ C Approximately beta**(-p), where beta is the machine
37
+ C radix and p is the number of significant base-beta
38
+ C digits in a floating-point number.
39
+ C XMAX = absolute argument beyond which DAW(X) underflows.
40
+ C XMAX = min(0.5/xmin, xinf).
41
+ C XSMALL = absolute argument below DAW(X) may be represented
42
+ C by X. We recommend XSMALL = sqrt(eps).
43
+ C XLARGE = argument beyond which DAW(X) may be represented by
44
+ C 1/(2x). We recommend XLARGE = 1/sqrt(eps).
45
+ C
46
+ C Approximate values for some important machines are
47
+ C
48
+ C beta p eps xmin xinf
49
+ C
50
+ C CDC 7600 (S.P.) 2 48 7.11E-15 3.14E-294 1.26E+322
51
+ C CRAY-1 (S.P.) 2 48 7.11E-15 4.58E-2467 5.45E+2465
52
+ C IEEE (IBM/XT,
53
+ C SUN, etc.) (S.P.) 2 24 1.19E-07 1.18E-38 3.40E+38
54
+ C IEEE (IBM/XT,
55
+ C SUN, etc.) (D.P.) 2 53 1.11D-16 2.23E-308 1.79D+308
56
+ C IBM 3033 (D.P.) 16 14 1.11D-16 5.40D-79 7.23D+75
57
+ C VAX 11/780 (S.P.) 2 24 5.96E-08 2.94E-39 1.70E+38
58
+ C (D.P.) 2 56 1.39D-17 2.94D-39 1.70D+38
59
+ C (G Format) (D.P.) 2 53 1.11D-16 5.57D-309 8.98D+307
60
+ C
61
+ C XSMALL XLARGE XMAX
62
+ C
63
+ C CDC 7600 (S.P.) 5.96E-08 1.68E+07 1.59E+293
64
+ C CRAY-1 (S.P.) 5.96E-08 1.68E+07 5.65E+2465
65
+ C IEEE (IBM/XT,
66
+ C SUN, etc.) (S.P.) 2.44E-04 4.10E+03 4.25E+37
67
+ C IEEE (IBM/XT,
68
+ C SUN, etc.) (D.P.) 1.05E-08 9.49E+07 2.24E+307
69
+ C IBM 3033 (D.P.) 3.73D-09 2.68E+08 7.23E+75
70
+ C VAX 11/780 (S.P.) 2.44E-04 4.10E+03 1.70E+38
71
+ C (D.P.) 3.73E-09 2.68E+08 1.70E+38
72
+ C (G Format) (D.P.) 1.05E-08 9.49E+07 8.98E+307
73
+ C
74
+ C*******************************************************************
75
+ C*******************************************************************
76
+ C
77
+ C Error Returns
78
+ C
79
+ C The program returns 0.0 for |X| > XMAX.
80
+ C
81
+ C Intrinsic functions required are:
82
+ C
83
+ C ABS
84
+ C
85
+ C
86
+ C Author: W. J. Cody
87
+ C Mathematics and Computer Science Division
88
+ C Argonne National Laboratory
89
+ C Argonne, IL 60439
90
+ C
91
+ C Latest modification: June 15, 1988
92
+ C
93
+ C----------------------------------------------------------------------
94
+ INTEGER I
95
+ C REAL
96
+ DOUBLE PRECISION
97
+ 1 DAW,FRAC,HALF,ONE,ONE225,P1,P2,P3,P4,Q1,Q2,Q3,Q4,SIX25,
98
+ 2 SUMP,SUMQ,TWO5,W2,X,XX,Y,XLARGE,XMAX,XSMALL,ZERO
99
+ DIMENSION P1(10),P2(10),P3(10),P4(10),Q1(10),Q2(9),Q3(9),Q4(9)
100
+ C----------------------------------------------------------------------
101
+ C Mathematical constants.
102
+ C----------------------------------------------------------------------
103
+ C DATA ZERO,HALF,ONE/0.0E0,0.5E0,1.0E0/,
104
+ C 1 SIX25,ONE225,TWO5/6.25E0,12.25E0,25.0E0/
105
+ DATA ZERO,HALF,ONE/0.0D0,0.5D0,1.0D0/,
106
+ 1 SIX25,ONE225,TWO5/6.25D0,12.25D0,25.0D0/
107
+ C----------------------------------------------------------------------
108
+ C Machine-dependent constants
109
+ C----------------------------------------------------------------------
110
+ C DATA XSMALL/2.44E-04/, XLARGE/4.10E+03/, XMAX/4.25E+37/
111
+ DATA XSMALL/1.05D-08/, XLARGE/9.49D+07/, XMAX/2.24D+307/
112
+ C----------------------------------------------------------------------
113
+ C Coefficients for R(9,9) approximation for |x| < 2.5
114
+ C----------------------------------------------------------------------
115
+ C DATA P1/-2.69020398788704782410E-12, 4.18572065374337710778E-10,
116
+ C 1 -1.34848304455939419963E-08, 9.28264872583444852976E-07,
117
+ C 2 -1.23877783329049120592E-05, 4.07205792429155826266E-04,
118
+ C 3 -2.84388121441008500446E-03, 4.70139022887204722217E-02,
119
+ C 4 -1.38868086253931995101E-01, 1.00000000000000000004E+00/
120
+ C DATA Q1/ 1.71257170854690554214E-10, 1.19266846372297253797E-08,
121
+ C 1 4.32287827678631772231E-07, 1.03867633767414421898E-05,
122
+ C 2 1.78910965284246249340E-04, 2.26061077235076703171E-03,
123
+ C 3 2.07422774641447644725E-02, 1.32212955897210128811E-01,
124
+ C 4 5.27798580412734677256E-01, 1.00000000000000000000E+00/
125
+ DATA P1/-2.69020398788704782410D-12, 4.18572065374337710778D-10,
126
+ 1 -1.34848304455939419963D-08, 9.28264872583444852976D-07,
127
+ 2 -1.23877783329049120592D-05, 4.07205792429155826266D-04,
128
+ 3 -2.84388121441008500446D-03, 4.70139022887204722217D-02,
129
+ 4 -1.38868086253931995101D-01, 1.00000000000000000004D+00/
130
+ DATA Q1/ 1.71257170854690554214D-10, 1.19266846372297253797D-08,
131
+ 1 4.32287827678631772231D-07, 1.03867633767414421898D-05,
132
+ 2 1.78910965284246249340D-04, 2.26061077235076703171D-03,
133
+ 3 2.07422774641447644725D-02, 1.32212955897210128811D-01,
134
+ 4 5.27798580412734677256D-01, 1.00000000000000000000D+00/
135
+ C----------------------------------------------------------------------
136
+ C Coefficients for R(9,9) approximation in J-fraction form
137
+ C for x in [2.5, 3.5)
138
+ C----------------------------------------------------------------------
139
+ C DATA P2/-1.70953804700855494930E+00,-3.79258977271042880786E+01,
140
+ C 1 2.61935631268825992835E+01, 1.25808703738951251885E+01,
141
+ C 2 -2.27571829525075891337E+01, 4.56604250725163310122E+00,
142
+ C 3 -7.33080089896402870750E+00, 4.65842087940015295573E+01,
143
+ C 4 -1.73717177843672791149E+01, 5.00260183622027967838E-01/
144
+ C DATA Q2/ 1.82180093313514478378E+00, 1.10067081034515532891E+03,
145
+ C 1 -7.08465686676573000364E+00, 4.53642111102577727153E+02,
146
+ C 2 4.06209742218935689922E+01, 3.02890110610122663923E+02,
147
+ C 3 1.70641269745236227356E+02, 9.51190923960381458747E+02,
148
+ C 4 2.06522691539642105009E-01/
149
+ DATA P2/-1.70953804700855494930D+00,-3.79258977271042880786D+01,
150
+ 1 2.61935631268825992835D+01, 1.25808703738951251885D+01,
151
+ 2 -2.27571829525075891337D+01, 4.56604250725163310122D+00,
152
+ 3 -7.33080089896402870750D+00, 4.65842087940015295573D+01,
153
+ 4 -1.73717177843672791149D+01, 5.00260183622027967838D-01/
154
+ DATA Q2/ 1.82180093313514478378D+00, 1.10067081034515532891D+03,
155
+ 1 -7.08465686676573000364D+00, 4.53642111102577727153D+02,
156
+ 2 4.06209742218935689922D+01, 3.02890110610122663923D+02,
157
+ 3 1.70641269745236227356D+02, 9.51190923960381458747D+02,
158
+ 4 2.06522691539642105009D-01/
159
+ C----------------------------------------------------------------------
160
+ C Coefficients for R(9,9) approximation in J-fraction form
161
+ C for x in [3.5, 5.0]
162
+ C----------------------------------------------------------------------
163
+ C DATA P3/-4.55169503255094815112E+00,-1.86647123338493852582E+01,
164
+ C 1 -7.36315669126830526754E+00,-6.68407240337696756838E+01,
165
+ C 2 4.84507265081491452130E+01, 2.69790586735467649969E+01,
166
+ C 3 -3.35044149820592449072E+01, 7.50964459838919612289E+00,
167
+ C 4 -1.48432341823343965307E+00, 4.99999810924858824981E-01/
168
+ C DATA Q3/ 4.47820908025971749852E+01, 9.98607198039452081913E+01,
169
+ C 1 1.40238373126149385228E+01, 3.48817758822286353588E+03,
170
+ C 2 -9.18871385293215873406E+00, 1.24018500009917163023E+03,
171
+ C 3 -6.88024952504512254535E+01,-2.31251575385145143070E+00,
172
+ C 4 2.50041492369922381761E-01/
173
+ DATA P3/-4.55169503255094815112D+00,-1.86647123338493852582D+01,
174
+ 1 -7.36315669126830526754D+00,-6.68407240337696756838D+01,
175
+ 2 4.84507265081491452130D+01, 2.69790586735467649969D+01,
176
+ 3 -3.35044149820592449072D+01, 7.50964459838919612289D+00,
177
+ 4 -1.48432341823343965307D+00, 4.99999810924858824981D-01/
178
+ DATA Q3/ 4.47820908025971749852D+01, 9.98607198039452081913D+01,
179
+ 1 1.40238373126149385228D+01, 3.48817758822286353588D+03,
180
+ 2 -9.18871385293215873406D+00, 1.24018500009917163023D+03,
181
+ 3 -6.88024952504512254535D+01,-2.31251575385145143070D+00,
182
+ 4 2.50041492369922381761D-01/
183
+ C----------------------------------------------------------------------
184
+ C Coefficients for R(9,9) approximation in J-fraction form
185
+ C for |x| > 5.0
186
+ C----------------------------------------------------------------------
187
+ C DATA P4/-8.11753647558432685797E+00,-3.84043882477454453430E+01,
188
+ C 1 -2.23787669028751886675E+01,-2.88301992467056105854E+01,
189
+ C 2 -5.99085540418222002197E+00,-1.13867365736066102577E+01,
190
+ C 3 -6.52828727526980741590E+00,-4.50002293000355585708E+00,
191
+ C 4 -2.50000000088955834952E+00, 5.00000000000000488400E-01/
192
+ C DATA Q4/ 2.69382300417238816428E+02, 5.04198958742465752861E+01,
193
+ C 1 6.11539671480115846173E+01, 2.08210246935564547889E+02,
194
+ C 2 1.97325365692316183531E+01,-1.22097010558934838708E+01,
195
+ C 3 -6.99732735041547247161E+00,-2.49999970104184464568E+00,
196
+ C 4 7.49999999999027092188E-01/
197
+ DATA P4/-8.11753647558432685797D+00,-3.84043882477454453430D+01,
198
+ 1 -2.23787669028751886675D+01,-2.88301992467056105854D+01,
199
+ 2 -5.99085540418222002197D+00,-1.13867365736066102577D+01,
200
+ 3 -6.52828727526980741590D+00,-4.50002293000355585708D+00,
201
+ 4 -2.50000000088955834952D+00, 5.00000000000000488400D-01/
202
+ DATA Q4/ 2.69382300417238816428D+02, 5.04198958742465752861D+01,
203
+ 1 6.11539671480115846173D+01, 2.08210246935564547889D+02,
204
+ 2 1.97325365692316183531D+01,-1.22097010558934838708D+01,
205
+ 3 -6.99732735041547247161D+00,-2.49999970104184464568D+00,
206
+ 4 7.49999999999027092188D-01/
207
+ C----------------------------------------------------------------------
208
+ X = XX
209
+ IF (ABS(X) .GT. XLARGE) THEN
210
+ IF (ABS(X) .LE. XMAX) THEN
211
+ DAW = HALF / X
212
+ ELSE
213
+ DAW = ZERO
214
+ END IF
215
+ ELSE IF (ABS(X) .LT. XSMALL) THEN
216
+ DAW = X
217
+ ELSE
218
+ Y = X * X
219
+ IF (Y .LT. SIX25) THEN
220
+ C----------------------------------------------------------------------
221
+ C ABS(X) .LT. 2.5
222
+ C----------------------------------------------------------------------
223
+ SUMP = P1(1)
224
+ SUMQ = Q1(1)
225
+ DO 100 I = 2, 10
226
+ SUMP = SUMP * Y + P1(I)
227
+ SUMQ = SUMQ * Y + Q1(I)
228
+ 100 CONTINUE
229
+ DAW = X * SUMP / SUMQ
230
+ ELSE IF (Y .LT. ONE225) THEN
231
+ C----------------------------------------------------------------------
232
+ C 2.5 .LE. ABS(X) .LT. 3.5
233
+ C----------------------------------------------------------------------
234
+ FRAC = ZERO
235
+ DO 200 I = 1, 9
236
+ 200 FRAC = Q2(I) / (P2(I) + Y + FRAC)
237
+ DAW = (P2(10) + FRAC) / X
238
+ ELSE IF (Y .LT. TWO5) THEN
239
+ C----------------------------------------------------------------------
240
+ C 3.5 .LE. ABS(X) .LT. 5.0
241
+ C---------------------------------------------------------------------
242
+ FRAC = ZERO
243
+ DO 300 I = 1, 9
244
+ 300 FRAC = Q3(I) / (P3(I) + Y + FRAC)
245
+ DAW = (P3(10) + FRAC) / X
246
+ ELSE
247
+ C----------------------------------------------------------------------
248
+ C 5.0 .LE. ABS(X) .LE. XLARGE
249
+ C------------------------------------------------------------------
250
+ W2 = ONE / X / X
251
+ FRAC = ZERO
252
+ DO 400 I = 1, 9
253
+ 400 FRAC = Q4(I) / (P4(I) + Y + FRAC)
254
+ FRAC = P4(10) + FRAC
255
+ DAW = (HALF + HALF * W2 * FRAC) / X
256
+ END IF
257
+ END IF
258
+ RETURN
259
+ C---------- Last line of DAW ----------
260
+ END