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

◆ slapy3()

real function slapy3 ( real  x,
real  y,
real  z 
)

SLAPY3 returns sqrt(x2+y2+z2).

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

Purpose:
 SLAPY3 returns sqrt(x**2+y**2+z**2), taking care not to cause
 unnecessary overflow and unnecessary underflow.
Parameters
[in]X
          X is REAL
[in]Y
          Y is REAL
[in]Z
          Z is REAL
          X, Y and Z specify the values x, y and z.
Author
Univ. of Tennessee
Univ. of California Berkeley
Univ. of Colorado Denver
NAG Ltd.

Definition at line 67 of file slapy3.f.

68*
69* -- LAPACK auxiliary routine --
70* -- LAPACK is a software package provided by Univ. of Tennessee, --
71* -- Univ. of California Berkeley, Univ. of Colorado Denver and NAG Ltd..--
72*
73* .. Scalar Arguments ..
74 REAL X, Y, Z
75* ..
76*
77* =====================================================================
78*
79* .. Parameters ..
80 REAL ZERO
81 parameter( zero = 0.0e0 )
82* ..
83* .. Local Scalars ..
84 REAL W, XABS, YABS, ZABS, HUGEVAL
85* ..
86* .. External Subroutines ..
87 REAL SLAMCH
88* ..
89* .. Intrinsic Functions ..
90 INTRINSIC abs, max, sqrt
91* ..
92* .. Executable Statements ..
93*
94 hugeval = slamch( 'Overflow' )
95 xabs = abs( x )
96 yabs = abs( y )
97 zabs = abs( z )
98 w = max( xabs, yabs, zabs )
99 IF( w.EQ.zero .OR. w.GT.hugeval ) THEN
100* W can be zero for max(0,nan,0)
101* adding all three entries together will make sure
102* NaN will not disappear.
103 slapy3 = xabs + yabs + zabs
104 ELSE
105 slapy3 = w*sqrt( ( xabs / w )**2+( yabs / w )**2+
106 $ ( zabs / w )**2 )
107 END IF
108 RETURN
109*
110* End of SLAPY3
111*
real function slamch(cmach)
SLAMCH
Definition slamch.f:68
real function slapy3(x, y, z)
SLAPY3 returns sqrt(x2+y2+z2).
Definition slapy3.f:68
program zabs
zabs tests the robustness and precision of the intrinsic ABS for double complex
Here is the call graph for this function:
Here is the caller graph for this function: