2019-03-20 12:25:42 +02:00
|
|
|
SUBROUTINE AZLOG(AR, AI, BR, BI, IERR)
|
|
|
|
C***BEGIN PROLOGUE AZLOG
|
2019-03-19 16:42:47 +02:00
|
|
|
C***REFER TO ZBESH,ZBESI,ZBESJ,ZBESK,ZBESY,ZAIRY,ZBIRY
|
|
|
|
C
|
|
|
|
C DOUBLE PRECISION COMPLEX LOGARITHM B=CLOG(A)
|
|
|
|
C IERR=0,NORMAL RETURN IERR=1, Z=CMPLX(0.0,0.0)
|
2019-03-20 12:25:42 +02:00
|
|
|
C***ROUTINES CALLED AZABS
|
|
|
|
C***END PROLOGUE AZLOG
|
2019-03-19 16:42:47 +02:00
|
|
|
DOUBLE PRECISION AR, AI, BR, BI, ZM, DTHETA, DPI, DHPI
|
2019-03-20 12:25:42 +02:00
|
|
|
DOUBLE PRECISION AZABS
|
2019-03-19 16:42:47 +02:00
|
|
|
DATA DPI , DHPI / 3.141592653589793238462643383D+0,
|
|
|
|
1 1.570796326794896619231321696D+0/
|
|
|
|
C
|
|
|
|
IERR=0
|
|
|
|
IF (AR.EQ.0.0D+0) GO TO 10
|
|
|
|
IF (AI.EQ.0.0D+0) GO TO 20
|
|
|
|
DTHETA = DATAN(AI/AR)
|
|
|
|
IF (DTHETA.LE.0.0D+0) GO TO 40
|
|
|
|
IF (AR.LT.0.0D+0) DTHETA = DTHETA - DPI
|
|
|
|
GO TO 50
|
|
|
|
10 IF (AI.EQ.0.0D+0) GO TO 60
|
|
|
|
BI = DHPI
|
|
|
|
BR = DLOG(DABS(AI))
|
|
|
|
IF (AI.LT.0.0D+0) BI = -BI
|
|
|
|
RETURN
|
|
|
|
20 IF (AR.GT.0.0D+0) GO TO 30
|
|
|
|
BR = DLOG(DABS(AR))
|
|
|
|
BI = DPI
|
|
|
|
RETURN
|
|
|
|
30 BR = DLOG(AR)
|
|
|
|
BI = 0.0D+0
|
|
|
|
RETURN
|
|
|
|
40 IF (AR.LT.0.0D+0) DTHETA = DTHETA + DPI
|
2019-03-20 12:25:42 +02:00
|
|
|
50 ZM = AZABS(AR,AI)
|
2019-03-19 16:42:47 +02:00
|
|
|
BR = DLOG(ZM)
|
|
|
|
BI = DTHETA
|
|
|
|
RETURN
|
|
|
|
60 CONTINUE
|
|
|
|
IERR=1
|
|
|
|
RETURN
|
|
|
|
END
|