90 integer,
parameter :: wp = kind(1.e0)
99 real(wp),
parameter :: zero = 0.0_wp
100 real(wp),
parameter :: one = 1.0_wp
101 real(wp),
parameter :: maxn = huge(0.0_wp)
104 real(wp),
parameter :: tsml = real(radix(0._wp), wp)**ceiling( &
105 (minexponent(0._wp) - 1) * 0.5_wp)
106 real(wp),
parameter :: tbig = real(radix(0._wp), wp)**floor( &
107 (maxexponent(0._wp) - digits(0._wp) + 1) * 0.5_wp)
108 real(wp),
parameter :: ssml = real(radix(0._wp), wp)**( - floor( &
109 (minexponent(0._wp) - digits(0._wp)) * 0.5_wp))
110 real(wp),
parameter :: sbig = real(radix(0._wp), wp)**( - ceiling( &
111 (maxexponent(0._wp) + digits(0._wp) - 1) * 0.5_wp))
122 real(wp) :: abig, amed, asml, ax, scl, sumsq, ymax, ymin
145 if( incx < 0 ) ix = 1 - (n-1)*incx
147 ax = abs(real(x(ix)))
149 abig = abig + (ax*sbig)**2
151 else if (ax < tsml)
then
152 if (notbig) asml = asml + (ax*ssml)**2
156 ax = abs(aimag(x(ix)))
158 abig = abig + (ax*sbig)**2
160 else if (ax < tsml)
then
161 if (notbig) asml = asml + (ax*ssml)**2
171 if (abig > zero)
then
175 if ( (amed > zero) .or. (amed > maxn) .or. (amed /= amed) )
then
176 abig = abig + (amed*sbig)*sbig
180 else if (asml > zero)
then
184 if ( (amed > zero) .or. (amed > maxn) .or. (amed /= amed) )
then
186 asml = sqrt(asml) / ssml
187 if (asml > amed)
then
195 sumsq = ymax**2*( one + (ymin/ymax)**2 )
207 scnrm2 = scl*sqrt( sumsq )
real(wp) function scnrm2(n, x, incx)
SCNRM2