00001 DOUBLE PRECISION FUNCTION XZABS(ZR, ZI) 00002 C***BEGIN PROLOGUE XZABS 00003 C***REFER TO ZBESH,ZBESI,ZBESJ,ZBESK,ZBESY,ZAIRY,ZBIRY 00004 C 00005 C XZABS COMPUTES THE ABSOLUTE VALUE OR MAGNITUDE OF A DOUBLE 00006 C PRECISION COMPLEX VARIABLE CMPLX(ZR,ZI) 00007 C 00008 C***ROUTINES CALLED (NONE) 00009 C***END PROLOGUE XZABS 00010 DOUBLE PRECISION ZR, ZI, U, V, Q, S 00011 U = DABS(ZR) 00012 V = DABS(ZI) 00013 S = U + V 00014 C----------------------------------------------------------------------- 00015 C S*1.0D0 MAKES AN UNNORMALIZED UNDERFLOW ON CDC MACHINES INTO A 00016 C TRUE FLOATING ZERO 00017 C----------------------------------------------------------------------- 00018 S = S*1.0D+0 00019 IF (S.EQ.0.0D+0) GO TO 20 00020 IF (U.GT.V) GO TO 10 00021 Q = U/V 00022 XZABS = V*DSQRT(1.D+0+Q*Q) 00023 RETURN 00024 10 Q = V/U 00025 XZABS = U*DSQRT(1.D+0+Q*Q) 00026 RETURN 00027 20 XZABS = 0.0D+0 00028 RETURN 00029 END