LAPACK  3.8.0
LAPACK: Linear Algebra PACKage

◆ dlapy3()

double precision function dlapy3 ( double precision  X,
double precision  Y,
double precision  Z 
)

DLAPY3 returns sqrt(x2+y2+z2).

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

Purpose:
 DLAPY3 returns sqrt(x**2+y**2+z**2), taking care not to cause
 unnecessary overflow.
Parameters
[in]X
          X is DOUBLE PRECISION
[in]Y
          Y is DOUBLE PRECISION
[in]Z
          Z is DOUBLE PRECISION
          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.
Date
December 2016

Definition at line 70 of file dlapy3.f.

70 *
71 * -- LAPACK auxiliary routine (version 3.7.0) --
72 * -- LAPACK is a software package provided by Univ. of Tennessee, --
73 * -- Univ. of California Berkeley, Univ. of Colorado Denver and NAG Ltd..--
74 * December 2016
75 *
76 * .. Scalar Arguments ..
77  DOUBLE PRECISION x, y, z
78 * ..
79 *
80 * =====================================================================
81 *
82 * .. Parameters ..
83  DOUBLE PRECISION zero
84  parameter( zero = 0.0d0 )
85 * ..
86 * .. Local Scalars ..
87  DOUBLE PRECISION w, xabs, yabs, zabs
88 * ..
89 * .. Intrinsic Functions ..
90  INTRINSIC abs, max, sqrt
91 * ..
92 * .. Executable Statements ..
93 *
94  xabs = abs( x )
95  yabs = abs( y )
96  zabs = abs( z )
97  w = max( xabs, yabs, zabs )
98  IF( w.EQ.zero ) THEN
99 * W can be zero for max(0,nan,0)
100 * adding all three entries together will make sure
101 * NaN will not disappear.
102  dlapy3 = xabs + yabs + zabs
103  ELSE
104  dlapy3 = w*sqrt( ( xabs / w )**2+( yabs / w )**2+
105  $ ( zabs / w )**2 )
106  END IF
107  RETURN
108 *
109 * End of DLAPY3
110 *
double precision function dlapy3(X, Y, Z)
DLAPY3 returns sqrt(x2+y2+z2).
Definition: dlapy3.f:70