#include "fpreproc/library_names.h"
#include "fpreproc/f77_dcomplx.h"
#include "fpreproc/fp_const.h"
*DECK DBESY0
      REAL*8 FUNCTION DBESY0 (X)
C***BEGIN PROLOGUE  DBESY0
C***PURPOSE  Compute the Bessel function of the second kind of order
C            zero.
C***LIBRARY   SLATEC (FNLIB)
C***CATEGORY  C10A1
C***TYPE      REAL*8 (BESY0-S, DBESY0-D)
C***KEYWORDS  BESSEL FUNCTION, FNLIB, ORDER ZERO, SECOND KIND,
C             SPECIAL FUNCTIONS
C***AUTHOR  Fullerton, W., (LANL)
C***DESCRIPTION
C
C DBESY0(X) calculates the double precision Bessel function of the
C second kind of order zero for double precision argument X.
C
C Series for BY0        on the interval  0.          to  1.60000E+01
C                                        with weighted error   8.14E-32
C                                         log weighted error  31.09
C                               significant figures required  30.31
C                                    decimal places required  31.73
C
C***REFERENCES  (NONE)
C***ROUTINES CALLED  D1MACH, D9B0MP, DBESJ0, 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  DBESY0
C============
C idecl:  explicitize implicit INTEGER declarations:
      IMPLICIT NONE
      INTEGER nty0,initds
C============
      REAL*8 X, BY0CS(19), AMPL, THETA, TWODPI, XSML,
     1  Y, D1MACH, DCSEVL, DBESJ0
      LOGICAL FIRST
      SAVE BY0CS, TWODPI, NTY0, XSML, FIRST
      DATA BY0CS(  1) / -CONST(.1127783939286557321793980546028,-1)/
      DATA BY0CS(  2) / -CONST(.1283452375604203460480884531838,+0)/
      DATA BY0CS(  3) / -CONST(.1043788479979424936581762276618,+0)/
      DATA BY0CS(  4) / +CONST(.2366274918396969540924159264613,-1)/
      DATA BY0CS(  5) / -CONST(.2090391647700486239196223950342,-2)/
      DATA BY0CS(  6) / +CONST(.1039754539390572520999246576381,-3)/
      DATA BY0CS(  7) / -CONST(.3369747162423972096718775345037,-5)/
      DATA BY0CS(  8) / +CONST(.7729384267670667158521367216371,-7)/
      DATA BY0CS(  9) / -CONST(.1324976772664259591443476068964,-8)/
      DATA BY0CS( 10) / +CONST(.1764823261540452792100389363158,-10)/
      DATA BY0CS( 11) / -CONST(.1881055071580196200602823012069,-12)/
      DATA BY0CS( 12) / +CONST(.1641865485366149502792237185749,-14)/
      DATA BY0CS( 13) / -CONST(.1195659438604606085745991006720,-16)/
      DATA BY0CS( 14) / +CONST(.7377296297440185842494112426666,-19)/
      DATA BY0CS( 15) / -CONST(.3906843476710437330740906666666,-21)/
      DATA BY0CS( 16) / +CONST(.1795503664436157949829120000000,-23)/
      DATA BY0CS( 17) / -CONST(.7229627125448010478933333333333,-26)/
      DATA BY0CS( 18) / +CONST(.2571727931635168597333333333333,-28)/
      DATA BY0CS( 19) / -CONST(.8141268814163694933333333333333,-31)/
      DATA TWODPI / CONST(0.636619772367581343075535053490057,0)/
      DATA FIRST /.TRUE./
C***FIRST EXECUTABLE STATEMENT  DBESY0
      IF (FIRST) THEN
         NTY0 = INITDS (BY0CS, 19, CONST(0.1,0)*AREAL(D1MACH(3)))
         XSML = SQRT(CONST(4.0,0)*D1MACH(3))
      ENDIF
      FIRST = .FALSE.
C
      IF (X .LE. CONST(0.,0)) CALL XERMSG ('SLATEC', 'DBESY0',
     +   'X IS ZERO OR NEGATIVE', 1, 2)
      IF (X.GT.CONST(4.0,0)) GO TO 20
C
      Y = CONST(0.,0)
      IF (X.GT.XSML) Y = X*X
      DBESY0 = TWODPI*LOG(CONST(0.5,0)*X)*DBESJ0(X) +
     1   CONST(.375,0)+ DCSEVL (
     1   CONST(.125,0)*Y-CONST(1.,0), BY0CS, NTY0)
      RETURN
C
 20   CALL D9B0MP (X, AMPL, THETA)
      DBESY0 = AMPL * SIN(THETA)
      RETURN
C
      END
! 22Jun2000 fgtok -s r8_precision.sub "r8con.csh conversion"
! 22Jun2000 fgtok
! 22Jun2000 fgtok
! 22Jun2000 fgtok
