LAPACK  3.10.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 and unnecessary underflow.
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.

Definition at line 62 of file dlapy2.f.

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