122122! =====================================================================
123123subroutine CLASSQ ( n , x , incx , scale , sumsq )
124124 use LA_CONSTANTS, &
125- only: wp= >sp, zero= >szero, one= >sone, safmin = >ssafmin, &
125+ only: wp= >sp, zero= >szero, one= >sone, &
126126 sbig= >ssbig, ssml= >sssml, tbig= >stbig, tsml= >stsml
127127 use LA_XISNAN
128128!
@@ -140,11 +140,7 @@ subroutine CLASSQ( n, x, incx, scale, sumsq )
140140! .. Local Scalars ..
141141 integer :: i, ix
142142 logical :: notbig
143- real (wp) :: abig, amed, asml, ax, ymax, ymin, sqrtmin, sqrtmax
144- ! ..
145- ! .. Set constants ..
146- sqrtmin = sqrt (safmin)
147- sqrtmax = one / sqrtmin
143+ real (wp) :: abig, amed, asml, ax, ymax, ymin
148144! ..
149145!
150146! Quick return if possible
@@ -201,42 +197,24 @@ subroutine CLASSQ( n, x, incx, scale, sumsq )
201197 ax = scale* sqrt ( sumsq )
202198 if (ax > tbig) then
203199 if (scale > one) then
204- scale = scale * sbig ! sbig < scale <= sbig * max
205- if (scale > sqrtmin) then
206- ! sqrtmin < scale < sqrtmax, so it is safe to square scale
207- abig = abig + (scale * scale) * sumsq
208- else
209- ! Do not square scale, as it may underflow
210- abig = abig + scale * (scale * sumsq)
211- end if
200+ scale = scale * sbig
201+ abig = abig + scale * (scale * sumsq)
212202 else
213203 ! sumsq > tbig^2 => (sbig * (sbig * sumsq)) is representable
214204 abig = abig + scale * (scale * (sbig * (sbig * sumsq)))
215205 end if
216206 else if (ax < tsml) then
217207 if (notbig) then
218208 if (scale < one) then
219- scale = scale * ssml ! ssml * min <= scale < ssml
220- if (scale < sqrtmax) then
221- ! sqrtmin < scale < sqrtmax, so it is safe to square scale
222- asml = asml + (scale * scale) * sumsq
223- else
224- ! Do not square scale, as it may overflow
225- asml = asml + scale * (scale * sumsq)
226- end if
209+ scale = scale * ssml
210+ asml = asml + scale * (scale * sumsq)
227211 else
228212 ! sumsq < tsml^2 => (ssml * (ssml * sumsq)) is representable
229213 asml = asml + scale * (scale * (ssml * (ssml * sumsq)))
230214 end if
231215 end if
232216 else
233- if (scale > sqrtmin .and. scale < sqrtmax) then
234- ! sqrtmin < scale < sqrtmax, so it is safe to square scale
235- amed = amed + (scale * scale) * sumsq
236- else
237- ! Do not square scale, as it may overflow
238- amed = amed + scale * (scale * sumsq)
239- end if
217+ amed = amed + scale * (scale * sumsq)
240218 end if
241219 end if
242220!
0 commit comments