01:       REAL             FUNCTION SLAPY2( X, Y )
02: *
03: *  -- LAPACK auxiliary routine (version 3.2) --
04: *  -- LAPACK is a software package provided by Univ. of Tennessee,    --
05: *  -- Univ. of California Berkeley, Univ. of Colorado Denver and NAG Ltd..--
06: *     November 2006
07: *
08: *     .. Scalar Arguments ..
09:       REAL               X, Y
10: *     ..
11: *
12: *  Purpose
13: *  =======
14: *
15: *  SLAPY2 returns sqrt(x**2+y**2), taking care not to cause unnecessary
16: *  overflow.
17: *
18: *  Arguments
19: *  =========
20: *
21: *  X       (input) REAL
22: *  Y       (input) REAL
23: *          X and Y specify the values x and y.
24: *
25: *  =====================================================================
26: *
27: *     .. Parameters ..
28:       REAL               ZERO
29:       PARAMETER          ( ZERO = 0.0E0 )
30:       REAL               ONE
31:       PARAMETER          ( ONE = 1.0E0 )
32: *     ..
33: *     .. Local Scalars ..
34:       REAL               W, XABS, YABS, Z
35: *     ..
36: *     .. Intrinsic Functions ..
37:       INTRINSIC          ABS, MAX, MIN, SQRT
38: *     ..
39: *     .. Executable Statements ..
40: *
41:       XABS = ABS( X )
42:       YABS = ABS( Y )
43:       W = MAX( XABS, YABS )
44:       Z = MIN( XABS, YABS )
45:       IF( Z.EQ.ZERO ) THEN
46:          SLAPY2 = W
47:       ELSE
48:          SLAPY2 = W*SQRT( ONE+( Z / W )**2 )
49:       END IF
50:       RETURN
51: *
52: *     End of SLAPY2
53: *
54:       END
55: