github.com/gopherd/gonum@v0.0.4/mathext/internal/amos/amoslib/zabs.f (about)

     1        DOUBLE PRECISION FUNCTION MZABS(ZR, ZI)
     2  C***BEGIN PROLOGUE  ZABS
     3  C***REFER TO  ZBESH,ZBESI,ZBESJ,ZBESK,ZBESY,ZAIRY,ZBIRY
     4  C
     5  C     ZABS 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  ZABS
    10        DOUBLE PRECISION ZR, ZI, U, V, Q, S
    11  
    12        MZABS = ZABS(CMPLX(ZR,ZI,kind=KIND(1.0D0)))
    13        RETURN
    14        END
    15  
    16  c      U = DABS(ZR)
    17  c      V = DABS(ZI)
    18  c      S = U + V
    19  C-----------------------------------------------------------------------
    20  C     S*1.0D0 MAKES AN UNNORMALIZED UNDERFLOW ON CDC MACHINES INTO A
    21  C     TRUE FLOATING ZERO
    22  C-----------------------------------------------------------------------
    23  c      S = S*1.0D+0
    24  c      IF (S.EQ.0.0D+0) GO TO 20
    25  c      IF (U.GT.V) GO TO 10
    26  c      Q = U/V
    27  c      ZABS = V*DSQRT(1.D+0+Q*Q)
    28  c      RETURN
    29  c   10 Q = V/U
    30  c      ZABS = U*DSQRT(1.D+0+Q*Q)
    31  c      RETURN
    32  c   20 ZABS = 0.0D+0
    33  c      RETURN
    34  c      END