Browse Source

Fix integer overflow in threshold calculation

Related to lapack issue 135, the threshold calculation can overflow as well as the multiplication is evaluated from left to right.
Without explicit parentheses, the calculation would overflow for N >= 18919
pull/1135/head
Martin Kroeker GitHub 9 years ago
parent
commit
ca89a16a72
1 changed files with 3 additions and 3 deletions
  1. +3
    -3
      lapack-netlib/SRC/dbdsqr.f

+ 3
- 3
lapack-netlib/SRC/dbdsqr.f View File

@@ -410,12 +410,12 @@
40 CONTINUE
50 CONTINUE
SMINOA = SMINOA / SQRT( DBLE( N ) )
THRESH = MAX( TOL*SMINOA, MAXITR*N*N*UNFL )
THRESH = MAX( TOL*SMINOA, MAXITR*(N*(N*UNFL)) )
ELSE
*
* Absolute accuracy desired
*
THRESH = MAX( ABS( TOL )*SMAX, MAXITR*N*N*UNFL )
THRESH = MAX( ABS( TOL )*SMAX, MAXITR*(N*(N*UNFL)) )
END IF
*
* Prepare for main iteration loop for the singular values
@@ -446,7 +446,7 @@
ITERDIVN = ITERDIVN + 1
IF (ITERDIVN.GE.MAXITDIVN )
$ GO TO 200
ENDIF
END IF
*
* Find diagonal block of matrix to work on
*


Loading…
Cancel
Save