LAPACK  3.9.0
LAPACK: Linear Algebra PACKage

◆ dlapy2()

double precision function dlapy2 ( double precision  X,
double precision  Y 
)

DLAPY2 returns sqrt(x2+y2).

Download DLAPY2 + dependencies [TGZ] [ZIP] [TXT]

Purpose:
 DLAPY2 returns sqrt(x**2+y**2), taking care not to cause unnecessary
 overflow.
Parameters
[in]X
          X is DOUBLE PRECISION
[in]Y
          Y is DOUBLE PRECISION
          X and Y specify the values x and y.
Author
Univ. of Tennessee
Univ. of California Berkeley
Univ. of Colorado Denver
NAG Ltd.
Date
June 2017

Definition at line 65 of file dlapy2.f.

65 *
66 * -- LAPACK auxiliary routine (version 3.7.1) --
67 * -- LAPACK is a software package provided by Univ. of Tennessee, --
68 * -- Univ. of California Berkeley, Univ. of Colorado Denver and NAG Ltd..--
69 * June 2017
70 *
71 * .. Scalar Arguments ..
72  DOUBLE PRECISION X, Y
73 * ..
74 *
75 * =====================================================================
76 *
77 * .. Parameters ..
78  DOUBLE PRECISION ZERO
79  parameter( zero = 0.0d0 )
80  DOUBLE PRECISION ONE
81  parameter( one = 1.0d0 )
82 * ..
83 * .. Local Scalars ..
84  DOUBLE PRECISION W, XABS, YABS, Z
85  LOGICAL X_IS_NAN, Y_IS_NAN
86 * ..
87 * .. External Functions ..
88  LOGICAL DISNAN
89  EXTERNAL disnan
90 * ..
91 * .. Intrinsic Functions ..
92  INTRINSIC abs, max, min, sqrt
93 * ..
94 * .. Executable Statements ..
95 *
96  x_is_nan = disnan( x )
97  y_is_nan = disnan( y )
98  IF ( x_is_nan ) dlapy2 = x
99  IF ( y_is_nan ) dlapy2 = y
100 *
101  IF ( .NOT.( x_is_nan.OR.y_is_nan ) ) THEN
102  xabs = abs( x )
103  yabs = abs( y )
104  w = max( xabs, yabs )
105  z = min( xabs, yabs )
106  IF( z.EQ.zero ) THEN
107  dlapy2 = w
108  ELSE
109  dlapy2 = w*sqrt( one+( z / w )**2 )
110  END IF
111  END IF
112  RETURN
113 *
114 * End of DLAPY2
115 *
Here is the call graph for this function:
Here is the caller graph for this function:
disnan
logical function disnan(DIN)
DISNAN tests input for NaN.
Definition: disnan.f:61
dlapy2
double precision function dlapy2(X, Y)
DLAPY2 returns sqrt(x2+y2).
Definition: dlapy2.f:65