LAPACK  3.10.0
LAPACK: Linear Algebra PACKage

◆ 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 62 of file slapy2.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  REAL X, Y
70 * ..
71 *
72 * =====================================================================
73 *
74 * .. Parameters ..
75  REAL ZERO
76  parameter( zero = 0.0e0 )
77  REAL ONE
78  parameter( one = 1.0e0 )
79 * ..
80 * .. Local Scalars ..
81  REAL W, XABS, YABS, Z
82  LOGICAL X_IS_NAN, Y_IS_NAN
83 * ..
84 * .. External Functions ..
85  LOGICAL SISNAN
86  EXTERNAL sisnan
87 * ..
88 * .. Intrinsic Functions ..
89  INTRINSIC abs, max, min, sqrt
90 * ..
91 * .. Executable Statements ..
92 *
93 * ..
94 * .. Executable Statements ..
95 *
96  x_is_nan = sisnan( x )
97  y_is_nan = sisnan( y )
98  IF ( x_is_nan ) slapy2 = x
99  IF ( y_is_nan ) slapy2 = 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  slapy2 = w
108  ELSE
109  slapy2 = w*sqrt( one+( z / w )**2 )
110  END IF
111  END IF
112  RETURN
113 *
114 * End of SLAPY2
115 *
real function slapy2(X, Y)
SLAPY2 returns sqrt(x2+y2).
Definition: slapy2.f:63
logical function sisnan(SIN)
SISNAN tests input for NaN.
Definition: sisnan.f:59
Here is the call graph for this function:
Here is the caller graph for this function: