OpenLibm/slatec/dbi.f
Viral B. Shah c977aa998f Add Makefile.extras to build libopenlibm-extras.
Replace amos with slatec
2012-12-31 16:37:05 -05:00

148 lines
7.4 KiB
Fortran

*DECK DBI
DOUBLE PRECISION FUNCTION DBI (X)
C***BEGIN PROLOGUE DBI
C***PURPOSE Evaluate the Bairy function (the Airy function of the
C second kind).
C***LIBRARY SLATEC (FNLIB)
C***CATEGORY C10D
C***TYPE DOUBLE PRECISION (BI-S, DBI-D)
C***KEYWORDS BAIRY FUNCTION, FNLIB, SPECIAL FUNCTIONS
C***AUTHOR Fullerton, W., (LANL)
C***DESCRIPTION
C
C DBI(X) calculates the double precision Airy function of the
C second kind for double precision argument X.
C
C Series for BIF on the interval -1.00000E+00 to 1.00000E+00
C with weighted error 1.45E-32
C log weighted error 31.84
C significant figures required 30.85
C decimal places required 32.40
C
C Series for BIG on the interval -1.00000E+00 to 1.00000E+00
C with weighted error 1.29E-33
C log weighted error 32.89
C significant figures required 31.48
C decimal places required 33.45
C
C Series for BIF2 on the interval 1.00000E+00 to 8.00000E+00
C with weighted error 6.08E-32
C log weighted error 31.22
C approx significant figures required 30.8
C decimal places required 31.80
C
C Series for BIG2 on the interval 1.00000E+00 to 8.00000E+00
C with weighted error 4.91E-33
C log weighted error 32.31
C approx significant figures required 31.6
C decimal places required 32.90
C
C***REFERENCES (NONE)
C***ROUTINES CALLED D1MACH, D9AIMP, DBIE, DCSEVL, INITDS, XERMSG
C***REVISION HISTORY (YYMMDD)
C 770701 DATE WRITTEN
C 890531 Changed all specific intrinsics to generic. (WRB)
C 890531 REVISION DATE from Version 3.2
C 891214 Prologue converted to Version 4.0 format. (BAB)
C 900315 CALLs to XERROR changed to CALLs to XERMSG. (THJ)
C***END PROLOGUE DBI
DOUBLE PRECISION X, BIFCS(13), BIGCS(13), BIF2CS(15), BIG2CS(15),
1 THETA, XM, XMAX, X3SML, Z, D1MACH, DCSEVL, DBIE
LOGICAL FIRST
SAVE BIFCS, BIGCS, BIF2CS, BIG2CS, NBIF, NBIG,
1 NBIF2, NBIG2, X3SML, XMAX, FIRST
DATA BIFCS( 1) / -.1673021647 1986649483 5374239281 76 D-1 /
DATA BIFCS( 2) / +.1025233583 4249445611 4263627777 57 D+0 /
DATA BIFCS( 3) / +.1708309250 7381516539 4296502420 13 D-2 /
DATA BIFCS( 4) / +.1186254546 7744681179 2164592100 40 D-4 /
DATA BIFCS( 5) / +.4493290701 7792133694 5318879272 42 D-7 /
DATA BIFCS( 6) / +.1069820714 3387889067 5677676636 28 D-9 /
DATA BIFCS( 7) / +.1748064339 9771824706 0105176285 73 D-12 /
DATA BIFCS( 8) / +.2081023107 1761711025 8818918343 99 D-15 /
DATA BIFCS( 9) / +.1884981469 5665416509 9279717333 33 D-18 /
DATA BIFCS( 10) / +.1342577917 3097804625 8826666666 66 D-21 /
DATA BIFCS( 11) / +.7715959342 9658887893 3333333333 33 D-25 /
DATA BIFCS( 12) / +.3653387961 7478566399 9999999999 99 D-28 /
DATA BIFCS( 13) / +.1449756592 7953066666 6666666666 66 D-31 /
DATA BIGCS( 1) / +.2246622324 8574522283 4682201390 24 D-1 /
DATA BIGCS( 2) / +.3736477545 3019545441 7275616667 52 D-1 /
DATA BIGCS( 3) / +.4447621895 7212285696 2152943266 39 D-3 /
DATA BIGCS( 4) / +.2470807563 6329384245 4945919488 82 D-5 /
DATA BIGCS( 5) / +.7919135339 5149635134 8624262855 96 D-8 /
DATA BIGCS( 6) / +.1649807985 1827779880 8878724027 06 D-10 /
DATA BIGCS( 7) / +.2411990666 4835455909 2475011228 41 D-13 /
DATA BIGCS( 8) / +.2610373623 6091436985 1847812693 33 D-16 /
DATA BIGCS( 9) / +.2175308297 7160323853 1237920000 00 D-19 /
DATA BIGCS( 10) / +.1438694640 0390433219 4837333333 33 D-22 /
DATA BIGCS( 11) / +.7734912561 2083468629 3333333333 33 D-26 /
DATA BIGCS( 12) / +.3446929203 3849002666 6666666666 66 D-29 /
DATA BIGCS( 13) / +.1293891927 3216000000 0000000000 00 D-32 /
DATA BIF2CS( 1) / +.0998457269 3816041044 6828425799 3 D+0 /
DATA BIF2CS( 2) / +.4786249778 6300553772 2114673182 31 D+0 /
DATA BIF2CS( 3) / +.2515521196 0433011771 3244154366 75 D-1 /
DATA BIF2CS( 4) / +.5820693885 2326456396 5156978722 16 D-3 /
DATA BIF2CS( 5) / +.7499765964 4377865943 8614573782 17 D-5 /
DATA BIF2CS( 6) / +.6134602870 3493836681 4030103564 74 D-7 /
DATA BIF2CS( 7) / +.3462753885 1480632900 4342687333 59 D-9 /
DATA BIF2CS( 8) / +.1428891008 0270254287 7708467489 31 D-11 /
DATA BIF2CS( 9) / +.4496270429 8334641895 0564721792 00 D-14 /
DATA BIF2CS( 10) / +.1114232306 5833011708 4283001066 66 D-16 /
DATA BIF2CS( 11) / +.2230479106 6175002081 5178666666 66 D-19 /
DATA BIF2CS( 12) / +.3681577873 6393142842 9226666666 66 D-22 /
DATA BIF2CS( 13) / +.5096086844 9338261333 3333333333 33 D-25 /
DATA BIF2CS( 14) / +.6000338692 6288554666 6666666666 66 D-28 /
DATA BIF2CS( 15) / +.6082749744 6570666666 6666666666 66 D-31 /
DATA BIG2CS( 1) / +.0333056621 4551434046 5176188111 647 D+0 /
DATA BIG2CS( 2) / +.1613092151 2319706761 3287532084 943 D+0 /
DATA BIG2CS( 3) / +.6319007309 6134286912 1615634921 173 D-2 /
DATA BIG2CS( 4) / +.1187904568 1625173638 9780192304 567 D-3 /
DATA BIG2CS( 5) / +.1304534588 6200265614 7116485012 843 D-5 /
DATA BIG2CS( 6) / +.9374125995 5352172954 6809615508 936 D-8 /
DATA BIG2CS( 7) / +.4745801886 7472515378 8510169834 595 D-10 /
DATA BIG2CS( 8) / +.1783107265 0948139980 0065667560 946 D-12 /
DATA BIG2CS( 9) / +.5167591927 8495818037 4276356640 000 D-15 /
DATA BIG2CS( 10) / +.1190045083 8682712512 9496251733 333 D-17 /
DATA BIG2CS( 11) / +.2229828806 6640351727 7063466666 666 D-20 /
DATA BIG2CS( 12) / +.3465519230 2768941972 2666666666 666 D-23 /
DATA BIG2CS( 13) / +.4539263363 2050451413 3333333333 333 D-26 /
DATA BIG2CS( 14) / +.5078849965 1352234666 6666666666 666 D-29 /
DATA BIG2CS( 15) / +.4910206746 9653333333 3333333333 333 D-32 /
DATA FIRST /.TRUE./
C***FIRST EXECUTABLE STATEMENT DBI
IF (FIRST) THEN
ETA = 0.1*REAL(D1MACH(3))
NBIF = INITDS (BIFCS, 13, ETA)
NBIG = INITDS (BIGCS, 13, ETA)
NBIF2 = INITDS (BIF2CS, 15, ETA)
NBIG2 = INITDS (BIG2CS, 15, ETA)
C
X3SML = ETA**0.3333
XMAX = (1.5*LOG(D1MACH(2)))**0.6666D0
ENDIF
FIRST = .FALSE.
C
IF (X.GE.(-1.0D0)) GO TO 20
CALL D9AIMP (X, XM, THETA)
DBI = XM * SIN(THETA)
RETURN
C
20 IF (X.GT.1.0D0) GO TO 30
Z = 0.D0
IF (ABS(X).GT.X3SML) Z = X**3
DBI = 0.625 + DCSEVL (Z, BIFCS, NBIF) + X*(0.4375D0 +
1 DCSEVL (Z, BIGCS, NBIG))
RETURN
C
30 IF (X.GT.2.0D0) GO TO 40
Z = (2.0D0*X**3 - 9.0D0)/7.D0
DBI = 1.125D0 + DCSEVL (Z, BIF2CS, NBIF2) + X*(0.625D0 +
1 DCSEVL (Z, BIG2CS, NBIG2))
RETURN
C
40 IF (X .GT. XMAX) CALL XERMSG ('SLATEC', 'DBI',
+ 'X SO BIG THAT BI OVERFLOWS', 1, 2)
C
DBI = DBIE(X) * EXP(2.0D0*X*SQRT(X)/3.0D0)
RETURN
C
END