LAPACK 3.12.1
LAPACK: Linear Algebra PACKage
Loading...
Searching...
No Matches
slapy3.f
Go to the documentation of this file.
1*> \brief \b SLAPY3 returns sqrt(x2+y2+z2).
2*
3* =========== DOCUMENTATION ===========
4*
5* Online html documentation available at
6* http://www.netlib.org/lapack/explore-html/
7*
8*> Download SLAPY3 + dependencies
9*> <a href="http://www.netlib.org/cgi-bin/netlibfiles.tgz?format=tgz&filename=/lapack/lapack_routine/slapy3.f">
10*> [TGZ]</a>
11*> <a href="http://www.netlib.org/cgi-bin/netlibfiles.zip?format=zip&filename=/lapack/lapack_routine/slapy3.f">
12*> [ZIP]</a>
13*> <a href="http://www.netlib.org/cgi-bin/netlibfiles.txt?format=txt&filename=/lapack/lapack_routine/slapy3.f">
14*> [TXT]</a>
15*
16* Definition:
17* ===========
18*
19* REAL FUNCTION SLAPY3( X, Y, Z )
20*
21* .. Scalar Arguments ..
22* REAL X, Y, Z
23* ..
24*
25*
26*> \par Purpose:
27* =============
28*>
29*> \verbatim
30*>
31*> SLAPY3 returns sqrt(x**2+y**2+z**2), taking care not to cause
32*> unnecessary overflow and unnecessary underflow.
33*> \endverbatim
34*
35* Arguments:
36* ==========
37*
38*> \param[in] X
39*> \verbatim
40*> X is REAL
41*> \endverbatim
42*>
43*> \param[in] Y
44*> \verbatim
45*> Y is REAL
46*> \endverbatim
47*>
48*> \param[in] Z
49*> \verbatim
50*> Z is REAL
51*> X, Y and Z specify the values x, y and z.
52*> \endverbatim
53*
54* Authors:
55* ========
56*
57*> \author Univ. of Tennessee
58*> \author Univ. of California Berkeley
59*> \author Univ. of Colorado Denver
60*> \author NAG Ltd.
61*
62*> \ingroup lapy3
63*
64* =====================================================================
65 REAL function slapy3( x, y, z )
66*
67* -- LAPACK auxiliary routine --
68* -- LAPACK is a software package provided by Univ. of Tennessee, --
69* -- Univ. of California Berkeley, Univ. of Colorado Denver and NAG Ltd..--
70*
71* .. Scalar Arguments ..
72 REAL x, y, z
73* ..
74*
75* =====================================================================
76*
77* .. Parameters ..
78 REAL zero
79 parameter( zero = 0.0e0 )
80* ..
81* .. Local Scalars ..
82 REAL w, xabs, yabs, zabs, hugeval
83* ..
84* .. External Subroutines ..
85 REAL slamch
86* ..
87* .. Intrinsic Functions ..
88 INTRINSIC abs, max, sqrt
89* ..
90* .. Executable Statements ..
91*
92 hugeval = slamch( 'Overflow' )
93 xabs = abs( x )
94 yabs = abs( y )
95 zabs = abs( z )
96 w = max( xabs, yabs, zabs )
97 IF( w.EQ.zero .OR. w.GT.hugeval ) THEN
98* W can be zero for max(0,nan,0)
99* adding all three entries together will make sure
100* NaN will not disappear.
101 slapy3 = xabs + yabs + zabs
102 ELSE
103 slapy3 = w*sqrt( ( xabs / w )**2+( yabs / w )**2+
104 $ ( zabs / w )**2 )
105 END IF
106 RETURN
107*
108* End of SLAPY3
109*
110 END
real function slamch(cmach)
SLAMCH
Definition slamch.f:68
real function slapy3(x, y, z)
SLAPY3 returns sqrt(x2+y2+z2).
Definition slapy3.f:66
program zabs
zabs tests the robustness and precision of the intrinsic ABS for double complex