Debian Codegraph @

Modules/ThirdParty/VNL/src/vxl/v3p/netlib/lapack/single/slapy2.f

raw
1 REAL FUNCTION SLAPY2( X, Y )
2 *
3 * -- LAPACK auxiliary routine (version 3.0) --
4 * Univ. of Tennessee, Univ. of California Berkeley, NAG Ltd.,
5 * Courant Institute, Argonne National Lab, and Rice University
6 * October 31, 1992
7 *
8 * .. Scalar Arguments ..
9 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