GNU Octave  3.8.0
A high-level interpreted language, primarily intended for numerical computations, mostly compatible with Matlab
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Pages
xzabs.f
Go to the documentation of this file.
1  DOUBLE PRECISION FUNCTION xzabs(ZR, ZI)
2 C***BEGIN PROLOGUE XZABS
3 C***REFER TO ZBESH,ZBESI,ZBESJ,ZBESK,ZBESY,ZAIRY,ZBIRY
4 C
5 C XZABS COMPUTES THE ABSOLUTE VALUE OR MAGNITUDE OF A DOUBLE
6 C PRECISION COMPLEX VARIABLE CMPLX(ZR,ZI)
7 C
8 C***ROUTINES CALLED (NONE)
9 C***END PROLOGUE XZABS
10  DOUBLE PRECISION zr, zi, u, v, q, s
11  u = dabs(zr)
12  v = dabs(zi)
13  s = u + v
14 C-----------------------------------------------------------------------
15 C S*1.0D0 MAKES AN UNNORMALIZED UNDERFLOW ON CDC MACHINES INTO A
16 C TRUE FLOATING ZERO
17 C-----------------------------------------------------------------------
18  s = s*1.0d+0
19  IF (s.EQ.0.0d+0) go to 20
20  IF (u.GT.v) go to 10
21  q = u/v
22  xzabs = v*dsqrt(1.d+0+q*q)
23  RETURN
24  10 q = v/u
25  xzabs = u*dsqrt(1.d+0+q*q)
26  RETURN
27  20 xzabs = 0.0d+0
28  RETURN
29  END