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

◆ slapy2()

real function slapy2 ( real x,
real y )

SLAPY2 returns sqrt(x2+y2).

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

Purpose:
!>
!> SLAPY2 returns sqrt(x**2+y**2), taking care not to cause unnecessary
!> overflow and unnecessary underflow.
!> 
Parameters
[in]X
!>          X is REAL
!> 
[in]Y
!>          Y is REAL
!>          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 slapy2.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 REAL X, Y
68* ..
69*
70* =====================================================================
71*
72* .. Parameters ..
73 REAL ZERO
74 parameter( zero = 0.0e0 )
75 REAL ONE
76 parameter( one = 1.0e0 )
77* ..
78* .. Local Scalars ..
79 REAL W, XABS, YABS, Z, HUGEVAL
80 LOGICAL X_IS_NAN, Y_IS_NAN
81* ..
82* .. External Functions ..
83 LOGICAL SISNAN
84 EXTERNAL sisnan
85* ..
86* .. External Subroutines ..
87 REAL SLAMCH
88* ..
89* .. Intrinsic Functions ..
90 INTRINSIC abs, max, min, sqrt
91* ..
92* .. Executable Statements ..
93*
94 x_is_nan = sisnan( x )
95 y_is_nan = sisnan( y )
96 IF ( x_is_nan ) slapy2 = x
97 IF ( y_is_nan ) slapy2 = y
98 hugeval = slamch( '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 slapy2 = w
107 ELSE
108 slapy2 = w*sqrt( one+( z / w )**2 )
109 END IF
110 END IF
111 RETURN
112*
113* End of SLAPY2
114*
logical function sisnan(sin)
SISNAN tests input for NaN.
Definition sisnan.f:57
real function slamch(cmach)
SLAMCH
Definition slamch.f:68
real function slapy2(x, y)
SLAPY2 returns sqrt(x2+y2).
Definition slapy2.f:61
Here is the call graph for this function:
Here is the caller graph for this function: