LAPACK 3.12.1
LAPACK: Linear Algebra PACKage
All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Macros Modules Pages
dlapy2.f
Go to the documentation of this file.
1*> \brief \b DLAPY2 returns sqrt(x2+y2).
2*
3* =========== DOCUMENTATION ===========
4*
5* Online html documentation available at
6* http://www.netlib.org/lapack/explore-html/
7*
8*> Download DLAPY2 + dependencies
9*> <a href="http://www.netlib.org/cgi-bin/netlibfiles.tgz?format=tgz&filename=/lapack/lapack_routine/dlapy2.f">
10*> [TGZ]</a>
11*> <a href="http://www.netlib.org/cgi-bin/netlibfiles.zip?format=zip&filename=/lapack/lapack_routine/dlapy2.f">
12*> [ZIP]</a>
13*> <a href="http://www.netlib.org/cgi-bin/netlibfiles.txt?format=txt&filename=/lapack/lapack_routine/dlapy2.f">
14*> [TXT]</a>
15*
16* Definition:
17* ===========
18*
19* DOUBLE PRECISION FUNCTION DLAPY2( X, Y )
20*
21* .. Scalar Arguments ..
22* DOUBLE PRECISION X, Y
23* ..
24*
25*
26*> \par Purpose:
27* =============
28*>
29*> \verbatim
30*>
31*> DLAPY2 returns sqrt(x**2+y**2), taking care not to cause unnecessary
32*> overflow and unnecessary underflow.
33*> \endverbatim
34*
35* Arguments:
36* ==========
37*
38*> \param[in] X
39*> \verbatim
40*> X is DOUBLE PRECISION
41*> \endverbatim
42*>
43*> \param[in] Y
44*> \verbatim
45*> Y is DOUBLE PRECISION
46*> X and Y specify the values x and y.
47*> \endverbatim
48*
49* Authors:
50* ========
51*
52*> \author Univ. of Tennessee
53*> \author Univ. of California Berkeley
54*> \author Univ. of Colorado Denver
55*> \author NAG Ltd.
56*
57*> \ingroup lapy2
58*
59* =====================================================================
60 DOUBLE PRECISION FUNCTION dlapy2( X, Y )
61*
62* -- LAPACK auxiliary routine --
63* -- LAPACK is a software package provided by Univ. of Tennessee, --
64* -- Univ. of California Berkeley, Univ. of Colorado Denver and NAG Ltd..--
65*
66* .. Scalar Arguments ..
67 DOUBLE PRECISION x, y
68* ..
69*
70* =====================================================================
71*
72* .. Parameters ..
73 DOUBLE PRECISION zero
74 parameter( zero = 0.0d0 )
75 DOUBLE PRECISION one
76 parameter( one = 1.0d0 )
77* ..
78* .. Local Scalars ..
79 DOUBLE PRECISION w, xabs, yabs, z, hugeval
80 LOGICAL x_is_nan, y_is_nan
81* ..
82* .. External Functions ..
83 LOGICAL disnan
84 EXTERNAL disnan
85* ..
86* .. External Subroutines ..
87 DOUBLE PRECISION dlamch
88* ..
89* .. Intrinsic Functions ..
90 INTRINSIC abs, max, min, sqrt
91* ..
92* .. Executable Statements ..
93*
94 x_is_nan = disnan( x )
95 y_is_nan = disnan( y )
96 IF ( x_is_nan ) dlapy2 = x
97 IF ( y_is_nan ) dlapy2 = y
98 hugeval = dlamch( 'Overflow' )
99*
100 IF ( .NOT.( x_is_nan.OR.y_is_nan ) ) THEN
101 xabs = abs( x )
102 yabs = abs( y )
103 w = max( xabs, yabs )
104 z = min( xabs, yabs )
105 IF( z.EQ.zero .OR. w.GT.hugeval ) THEN
106 dlapy2 = w
107 ELSE
108 dlapy2 = w*sqrt( one+( z / w )**2 )
109 END IF
110 END IF
111 RETURN
112*
113* End of DLAPY2
114*
115 END
logical function disnan(din)
DISNAN tests input for NaN.
Definition disnan.f:57
double precision function dlamch(cmach)
DLAMCH
Definition dlamch.f:69
double precision function dlapy2(x, y)
DLAPY2 returns sqrt(x2+y2).
Definition dlapy2.f:61