added NaN check to prevent NaN's from being skipped in accumulation
authorjames <james@8a072113-8704-0410-8d35-dd094bca7971>
Tue, 17 Jul 2012 13:15:40 +0000 (13:15 +0000)
committerjames <james@8a072113-8704-0410-8d35-dd094bca7971>
Tue, 17 Jul 2012 13:15:40 +0000 (13:15 +0000)
SRC/classq.f
SRC/dlassq.f
SRC/slassq.f
SRC/zlassq.f

index af027f9dac7dfff22c2cbbc4cb09288d2d268b26..2b8a5033ae0e4f2da135b46131fc781c21fadc38 100644 (file)
       INTEGER            IX
       REAL               TEMP1
 *     ..
+*     .. External Functions ..
+      LOGICAL            SISNAN
+      EXTERNAL           SISNAN
+*     ..
 *     .. Intrinsic Functions ..
       INTRINSIC          ABS, AIMAG, REAL
 *     ..
 *
       IF( N.GT.0 ) THEN
          DO 10 IX = 1, 1 + ( N-1 )*INCX, INCX
-            IF( REAL( X( IX ) ).NE.ZERO ) THEN
-               TEMP1 = ABS( REAL( X( IX ) ) )
+            TEMP1 = ABS( REAL( X( IX ) ) )
+            IF( TEMP1.GT.ZERO.OR.SISNAN( TEMP1 ) ) THEN
                IF( SCALE.LT.TEMP1 ) THEN
                   SUMSQ = 1 + SUMSQ*( SCALE / TEMP1 )**2
                   SCALE = TEMP1
                   SUMSQ = SUMSQ + ( TEMP1 / SCALE )**2
                END IF
             END IF
-            IF( AIMAG( X( IX ) ).NE.ZERO ) THEN
-               TEMP1 = ABS( AIMAG( X( IX ) ) )
-               IF( SCALE.LT.TEMP1 ) THEN
+            TEMP1 = ABS( AIMAG( X( IX ) ) )
+            IF( TEMP1.GT.ZERO.OR.SISNAN( TEMP1 ) ) THEN
+               IF( SCALE.LT.TEMP1 .OR. SISNAN( TEMP1 ) ) THEN
                   SUMSQ = 1 + SUMSQ*( SCALE / TEMP1 )**2
                   SCALE = TEMP1
                ELSE
index db5b5946daa97590aa11700ba09ff18710007d03..ee039b93d5c4eaf83fbf07b11c9cd5b71a9d81ec 100644 (file)
       INTEGER            IX
       DOUBLE PRECISION   ABSXI
 *     ..
+*     .. External Functions ..
+      LOGICAL            DISNAN
+      EXTERNAL           DISNAN
+*     ..
 *     .. Intrinsic Functions ..
       INTRINSIC          ABS
 *     ..
 *
       IF( N.GT.0 ) THEN
          DO 10 IX = 1, 1 + ( N-1 )*INCX, INCX
-            IF( X( IX ).NE.ZERO ) THEN
-               ABSXI = ABS( X( IX ) )
+            ABSXI = ABS( X( IX ) )
+            IF( ABSXI.GT.ZERO.OR.DISNAN( ABSXI ) ) THEN
                IF( SCALE.LT.ABSXI ) THEN
                   SUMSQ = 1 + SUMSQ*( SCALE / ABSXI )**2
                   SCALE = ABSXI
index 8e87380843b5bb35e76c20e38179a0f265d4166e..f8af90493dccc150c931747f0e7a38e5a24027e2 100644 (file)
       INTEGER            IX
       REAL               ABSXI
 *     ..
+*     .. External Functions ..
+      LOGICAL            SISNAN
+      EXTERNAL           SISNAN
+*     ..
 *     .. Intrinsic Functions ..
       INTRINSIC          ABS
 *     ..
 *
       IF( N.GT.0 ) THEN
          DO 10 IX = 1, 1 + ( N-1 )*INCX, INCX
-            IF( X( IX ).NE.ZERO ) THEN
-               ABSXI = ABS( X( IX ) )
+            ABSXI = ABS( X( IX ) )
+            IF( ABSXI.GT.ZERO.OR.SISNAN( ABSXI ) ) THEN
                IF( SCALE.LT.ABSXI ) THEN
                   SUMSQ = 1 + SUMSQ*( SCALE / ABSXI )**2
                   SCALE = ABSXI
index d69b5ba3ba775dcd006b5233785bb2baaf7c7f0f..59ad6966327d8053990e28fab43755e30d7265ec 100644 (file)
       INTEGER            IX
       DOUBLE PRECISION   TEMP1
 *     ..
+*     .. External Functions ..
+      LOGICAL            DISNAN
+      EXTERNAL           DISNAN
+*     ..
 *     .. Intrinsic Functions ..
       INTRINSIC          ABS, DBLE, DIMAG
 *     ..
 *
       IF( N.GT.0 ) THEN
          DO 10 IX = 1, 1 + ( N-1 )*INCX, INCX
-            IF( DBLE( X( IX ) ).NE.ZERO ) THEN
-               TEMP1 = ABS( DBLE( X( IX ) ) )
+            TEMP1 = ABS( DBLE( X( IX ) ) )
+            IF( TEMP1.GT.ZERO.OR.DISNAN( TEMP1 ) ) THEN
                IF( SCALE.LT.TEMP1 ) THEN
                   SUMSQ = 1 + SUMSQ*( SCALE / TEMP1 )**2
                   SCALE = TEMP1
                   SUMSQ = SUMSQ + ( TEMP1 / SCALE )**2
                END IF
             END IF
-            IF( DIMAG( X( IX ) ).NE.ZERO ) THEN
-               TEMP1 = ABS( DIMAG( X( IX ) ) )
+            TEMP1 = ABS( DIMAG( X( IX ) ) )
+            IF( TEMP1.GT.ZERO.OR.DISNAN( TEMP1 ) ) THEN
                IF( SCALE.LT.TEMP1 ) THEN
                   SUMSQ = 1 + SUMSQ*( SCALE / TEMP1 )**2
                   SCALE = TEMP1