GNU Octave  6.2.0
A high-level interpreted language, primarily intended for numerical computations, mostly compatible with Matlab
xzlog.f
Go to the documentation of this file.
1  SUBROUTINE xzlog(AR, AI, BR, BI, IERR)
2 C***BEGIN PROLOGUE XZLOG
3 C***REFER TO ZBESH,ZBESI,ZBESJ,ZBESK,ZBESY,ZAIRY,ZBIRY
4 C
5 C DOUBLE PRECISION COMPLEX LOGARITHM B=CLOG(A)
6 C IERR=0,NORMAL RETURN IERR=1, Z=CMPLX(0.0,0.0)
7 C***ROUTINES CALLED XZABS
8 C***END PROLOGUE XZLOG
9  DOUBLE PRECISION AR, AI, BR, BI, ZM, DTHETA, DPI, DHPI
10  DOUBLE PRECISION XZABS
11  DATA dpi , dhpi / 3.141592653589793238462643383d+0,
12  1 1.570796326794896619231321696d+0/
13 C
14  ierr=0
15  IF (ar.EQ.0.0d+0) GO TO 10
16  IF (ai.EQ.0.0d+0) GO TO 20
17  dtheta = datan(ai/ar)
18  IF (dtheta.LE.0.0d+0) GO TO 40
19  IF (ar.LT.0.0d+0) dtheta = dtheta - dpi
20  GO TO 50
21  10 IF (ai.EQ.0.0d+0) GO TO 60
22  bi = dhpi
23  br = dlog(dabs(ai))
24  IF (ai.LT.0.0d+0) bi = -bi
25  RETURN
26  20 IF (ar.GT.0.0d+0) GO TO 30
27  br = dlog(dabs(ar))
28  bi = dpi
29  RETURN
30  30 br = dlog(ar)
31  bi = 0.0d+0
32  RETURN
33  40 IF (ar.LT.0.0d+0) dtheta = dtheta + dpi
34  50 zm = xzabs(ar,ai)
35  br = dlog(zm)
36  bi = dtheta
37  RETURN
38  60 CONTINUE
39  ierr=1
40  RETURN
41  END
subroutine xzlog(AR, AI, BR, BI, IERR)
Definition: xzlog.f:2