      double precision function daide (x)
c july 1980 edition.  w. fullerton, bell labs.
c
c evaluate the derivative of the airy function for x .le. 0
c and evaluate  aid(x) * exp(zeta)  for x .ge. 0  where
c      zeta = 2/3 * x**(3/2)
c
      double precision x, aifcs(13), aigcs(13), aip1cs(57), aip2cs(37),
     1  x2sml, x3sml, x32sml, xbig, x3, x2, sqrtx, z, xn, phi,
     2  d1mach, dcsevl, dcos, dexp, dsqrt
      external d1mach, dcos, dcsevl, dexp, dsqrt, initds, sqrt
c
c series for aif    on the interval -1.00000e+00 to  1.00000e+00
c                                        with weighted error   2.20e-34
c                                         log weighted error  33.66
c                               significant figures required  32.39
c                                    decimal places required  34.21
c
      data aif cs(  1) /  0.1052746122 6531408808 8970057325 134114d0/
      data aif cs(  2) /  0.0118361362 8152997844 2889292583 980840d0/
      data aif cs(  3) /  0.0001232810 4173225664 3051689242 469164d0/
      data aif cs(  4) /  0.0000006226 1225638139 9016825658 693579d0/
      data aif cs(  5) /  0.0000000018 5298887844 1452950548 140821d0/
      data aif cs(  6) /  0.0000000000 0363328872 5904357915 995625d0/
      data aif cs(  7) /  0.0000000000 0000504621 7040440664 768330d0/
      data aif cs(  8) /  0.0000000000 0000000522 3816555471 480985d0/
      data aif cs(  9) /  0.0000000000 0000000000 4185745090 748989d0/
      data aif cs( 10) /  0.0000000000 0000000000 0002672887 324883d0/
      data aif cs( 11) /  0.0000000000 0000000000 0000001392 128006d0/
      data aif cs( 12) /  0.0000000000 0000000000 0000000000 602653d0/
      data aif cs( 13) /  0.0000000000 0000000000 0000000000 000220d0/
c
c series for aig    on the interval -1.00000e+00 to  1.00000e+00
c                                        with weighted error   2.76e-32
c                                         log weighted error  31.56
c                               significant figures required  30.50
c                                    decimal places required  32.12
c
      data aig cs(  1) /  0.0212338781 5091866685 2312227684 8937d0/
      data aig cs(  2) /  0.0863159303 3521440675 2494280946 1604d0/
      data aig cs(  3) /  0.0017975947 2038323135 7803396322 5230d0/
      data aig cs(  4) /  0.0000142654 9987555069 3252662068 7495d0/
      data aig cs(  5) /  0.0000000594 3799528368 3201048878 7064d0/
      data aig cs(  6) /  0.0000000001 5240336647 9447894521 4786d0/
      data aig cs(  7) /  0.0000000000 0026458766 0349043530 5100d0/
      data aig cs(  8) /  0.0000000000 0000033156 2429681502 0591d0/
      data aig cs(  9) /  0.0000000000 0000000031 3978975759 4792d0/
      data aig cs( 10) /  0.0000000000 0000000000 0232576737 9040d0/
      data aig cs( 11) /  0.0000000000 0000000000 0000138438 4231d0/
      data aig cs( 12) /  0.0000000000 0000000000 0000000067 6629d0/
      data aig cs( 13) /  0.0000000000 0000000000 0000000000 0276d0/
c
c series for aip2 on the interval  0.00000e+00 to  1.25000e-01
c                                        with weighted error   3.53e-32
c                                         log weighted error  31.45
c                               significant figures required  29.06
c                                    decimal places required  32.24
c
      data aip2cs(  1) /  0.0065457691 9897137567 9427697906 7064d0/
      data aip2cs(  2) /  0.0023833724 1207745919 9277255288 6923d0/
      data aip2cs(  3) / -0.0000430700 7702205858 6277501211 0584d0/
      data aip2cs(  4) /  0.0000015629 1258586292 0233078536 9063d0/
      data aip2cs(  5) / -0.0000000815 4171861627 0696511250 1015d0/
      data aip2cs(  6) /  0.0000000054 1037380569 3591820800 8783d0/
      data aip2cs(  7) / -0.0000000004 2841308826 1469652876 6222d0/
      data aip2cs(  8) /  0.0000000000 3894979628 3228642486 2198d0/
      data aip2cs(  9) / -0.0000000000 0396231612 6497925765 8071d0/
      data aip2cs( 10) /  0.0000000000 0044281842 1440598960 2353d0/
      data aip2cs( 11) / -0.0000000000 0005362965 2715068967 5318d0/
      data aip2cs( 12) /  0.0000000000 0000696498 7213993602 8200d0/
      data aip2cs( 13) / -0.0000000000 0000096196 3628609531 9210d0/
      data aip2cs( 14) /  0.0000000000 0000014034 5496778480 8032d0/
      data aip2cs( 15) / -0.0000000000 0000002150 9713652587 5715d0/
      data aip2cs( 16) /  0.0000000000 0000000344 7123063267 8283d0/
      data aip2cs( 17) / -0.0000000000 0000000057 5390762181 9442d0/
      data aip2cs( 18) /  0.0000000000 0000000009 9700116582 4168d0/
      data aip2cs( 19) / -0.0000000000 0000000001 7881143602 1458d0/
      data aip2cs( 20) /  0.0000000000 0000000000 3311030792 3551d0/
      data aip2cs( 21) / -0.0000000000 0000000000 0631588552 9506d0/
      data aip2cs( 22) /  0.0000000000 0000000000 0123866695 2364d0/
      data aip2cs( 23) / -0.0000000000 0000000000 0024932405 3394d0/
      data aip2cs( 24) /  0.0000000000 0000000000 0005142603 0999d0/
      data aip2cs( 25) / -0.0000000000 0000000000 0001085423 6402d0/
      data aip2cs( 26) /  0.0000000000 0000000000 0000234131 6852d0/
      data aip2cs( 27) / -0.0000000000 0000000000 0000051554 2099d0/
      data aip2cs( 28) /  0.0000000000 0000000000 0000011575 8841d0/
      data aip2cs( 29) / -0.0000000000 0000000000 0000002647 9669d0/
      data aip2cs( 30) /  0.0000000000 0000000000 0000000616 5328d0/
      data aip2cs( 31) / -0.0000000000 0000000000 0000000145 9931d0/
      data aip2cs( 32) /  0.0000000000 0000000000 0000000035 1331d0/
      data aip2cs( 33) / -0.0000000000 0000000000 0000000008 5863d0/
      data aip2cs( 34) /  0.0000000000 0000000000 0000000002 1297d0/
      data aip2cs( 35) / -0.0000000000 0000000000 0000000000 5358d0/
      data aip2cs( 36) /  0.0000000000 0000000000 0000000000 1367d0/
      data aip2cs( 37) / -0.0000000000 0000000000 0000000000 0353d0/
c
c series for aip1 on the interval  1.25000e-01 to  1.00000e+00
c                                        with weighted error   3.79e-32
c                                         log weighted error  31.42
c                               significant figures required  29.75
c                                    decimal places required  32.30
c
      data aip1cs(  1) /  0.0358865097 8083015379 5671048926 1688d0/
      data aip1cs(  2) /  0.0114668575 6277648985 7270088312 1766d0/
      data aip1cs(  3) / -0.0007592073 5838614003 0133564760 1603d0/
      data aip1cs(  4) /  0.0000869517 6108938412 7194861943 4021d0/
      data aip1cs(  5) / -0.0000128237 2942985916 9178960760 0486d0/
      data aip1cs(  6) /  0.0000022062 6956810383 3693437625 0420d0/
      data aip1cs(  7) / -0.0000004222 2951859207 4948694598 8432d0/
      data aip1cs(  8) /  0.0000000874 6864157263 4847935613 0376d0/
      data aip1cs(  9) / -0.0000000192 7735884183 6538862569 3417d0/
      data aip1cs( 10) /  0.0000000044 6684600544 9271969977 7137d0/
      data aip1cs( 11) / -0.0000000010 7901080519 4816801574 7466d0/
      data aip1cs( 12) /  0.0000000002 7000294466 9624808307 1434d0/
      data aip1cs( 13) / -0.0000000000 6964801080 0791525731 8929d0/
      data aip1cs( 14) /  0.0000000000 1844899070 0324668707 6806d0/
      data aip1cs( 15) / -0.0000000000 0500278173 5807169830 1149d0/
      data aip1cs( 16) /  0.0000000000 0138522433 6601216829 7298d0/
      data aip1cs( 17) / -0.0000000000 0039082184 6665704825 3473d0/
      data aip1cs( 18) /  0.0000000000 0011215360 7252456345 1273d0/
      data aip1cs( 19) / -0.0000000000 0003268615 2257950252 2443d0/
      data aip1cs( 20) /  0.0000000000 0000966191 7901009080 5752d0/
      data aip1cs( 21) / -0.0000000000 0000289347 6744269843 4271d0/
      data aip1cs( 22) /  0.0000000000 0000087700 8666115089 7069d0/
      data aip1cs( 23) / -0.0000000000 0000026880 4626119585 3754d0/
      data aip1cs( 24) /  0.0000000000 0000008324 9882387234 2992d0/
      data aip1cs( 25) / -0.0000000000 0000002603 4325478694 7057d0/
      data aip1cs( 26) /  0.0000000000 0000000821 5952814268 6287d0/
      data aip1cs( 27) / -0.0000000000 0000000261 5040670498 4940d0/
      data aip1cs( 28) /  0.0000000000 0000000083 9056346326 1051d0/
      data aip1cs( 29) / -0.0000000000 0000000027 1268561862 9660d0/
      data aip1cs( 30) /  0.0000000000 0000000008 8333337527 1942d0/
      data aip1cs( 31) / -0.0000000000 0000000002 8960320682 2333d0/
      data aip1cs( 32) /  0.0000000000 0000000000 9556218592 8676d0/
      data aip1cs( 33) / -0.0000000000 0000000000 3172746356 9051d0/
      data aip1cs( 34) /  0.0000000000 0000000000 1059557696 0768d0/
      data aip1cs( 35) / -0.0000000000 0000000000 0355825376 5402d0/
      data aip1cs( 36) /  0.0000000000 0000000000 0120133468 0517d0/
      data aip1cs( 37) / -0.0000000000 0000000000 0040766688 3800d0/
      data aip1cs( 38) /  0.0000000000 0000000000 0013901694 4446d0/
      data aip1cs( 39) / -0.0000000000 0000000000 0004762816 5730d0/
      data aip1cs( 40) /  0.0000000000 0000000000 0001639126 5551d0/
      data aip1cs( 41) / -0.0000000000 0000000000 0000566549 1354d0/
      data aip1cs( 42) /  0.0000000000 0000000000 0000196638 1969d0/
      data aip1cs( 43) / -0.0000000000 0000000000 0000068523 0229d0/
      data aip1cs( 44) /  0.0000000000 0000000000 0000023970 6939d0/
      data aip1cs( 45) / -0.0000000000 0000000000 0000008416 6831d0/
      data aip1cs( 46) /  0.0000000000 0000000000 0000002965 9364d0/
      data aip1cs( 47) / -0.0000000000 0000000000 0000001048 7947d0/
      data aip1cs( 48) /  0.0000000000 0000000000 0000000372 1150d0/
      data aip1cs( 49) / -0.0000000000 0000000000 0000000132 4570d0/
      data aip1cs( 50) /  0.0000000000 0000000000 0000000047 2976d0/
      data aip1cs( 51) / -0.0000000000 0000000000 0000000016 9405d0/
      data aip1cs( 52) /  0.0000000000 0000000000 0000000006 0855d0/
      data aip1cs( 53) / -0.0000000000 0000000000 0000000002 1924d0/
      data aip1cs( 54) /  0.0000000000 0000000000 0000000000 7920d0/
      data aip1cs( 55) / -0.0000000000 0000000000 0000000000 2869d0/
      data aip1cs( 56) /  0.0000000000 0000000000 0000000000 1042d0/
      data aip1cs( 57) / -0.0000000000 0000000000 0000000000 0379d0/
c
      data naif, naig, naip1, naip2 / 4*0 /
      data x2sml, x3sml, x32sml, xbig / 4*0.0d0 /
c
      if (naif.ne.0) go to 10
      eta = 0.1*sngl(d1mach(3))
      naif = initds (aifcs, 13, eta)
      naig = initds (aigcs, 13, eta)
      naip1 = initds (aip1cs, 57, eta)
      naip2 = initds (aip2cs, 37, eta)
c
      x2sml = sqrt (eta)
      x3sml = eta**0.3333
      x32sml = 1.3104d0*x3sml**2
      xbig = d1mach(2)**0.6666d0
c
 10   if (x.ge.(-1.0d0)) go to 20
      call d9admp (x, xn, phi)
      daide = xn * dcos(phi)
      return
c
 20   if (x.gt.1.0d0) go to 30
      x3 = 0.0d0
      if (dabs(x).gt.x3sml) x3 = x**3
      x2 = 0.0d0
      if (dabs(x).gt.x2sml) x2 = x*x
      daide = (x2*(0.125d0 + dcsevl(x3, aifcs, naif)) -
     1  dcsevl (x3, aigcs, naig)) - 0.25d0
      if (x.gt.x32sml) daide = daide * dexp(2.0d0*x*dsqrt(x)/3.0d0)
      return
c
 30   if (x.gt.4.0d0) go to 40
      sqrtx = dsqrt(x)
      z = (16.0d0/(x*sqrtx) - 9.0d0) / 7.0d0
      daide = (-0.28125d0 - dcsevl (z, aip1cs, naip1)) * dsqrt(sqrtx)
      return
c
 40   sqrtx = dsqrt(x)
      z = -1.0d0
      if (x.lt.xbig) z = 16.0d0/(x*sqrtx) - 1.0d0
      daide = (-0.28125d0 - dcsevl (z, aip2cs, naip2)) * dsqrt (sqrtx)
      return
c
      end