LAPACK 3.12.1
LAPACK: Linear Algebra PACKage
Loading...
Searching...
No Matches

◆ 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 60 of file dlapy2.f.

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*
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
Here is the call graph for this function:
Here is the caller graph for this function: