diff options
author | Julien Langou <julien.langou@ucdenver.edu> | 2017-03-23 15:43:42 -0400 |
---|---|---|
committer | Julien Langou <julien.langou@ucdenver.edu> | 2017-03-23 15:43:42 -0400 |
commit | e38b42afcd22481b780cdccae45756dd3117edd8 (patch) | |
tree | 98dbfa733b0eef862744f73f061107584dd3a850 | |
parent | 42fe66c8488b5d7a9117e9ca72d0a563f765cd08 (diff) | |
download | lapack-e38b42afcd22481b780cdccae45756dd3117edd8.tar.gz lapack-e38b42afcd22481b780cdccae45756dd3117edd8.tar.bz2 lapack-e38b42afcd22481b780cdccae45756dd3117edd8.zip |
This is related to #135
Since the order of multiplication in Fortran is left to right, the expression
MAXITR*N*N*UNFL
first computes MAXITR*N*N as an INTEGER. This causes INTEGER overflow for
N>=18919.
To avoid the problem, rewrite as:
MAXITR*(N*(N*UNFL))
-rw-r--r-- | SRC/dbdsqr.f | 4 | ||||
-rw-r--r-- | SRC/sbdsqr.f | 4 |
2 files changed, 4 insertions, 4 deletions
diff --git a/SRC/dbdsqr.f b/SRC/dbdsqr.f index 0e46e71c..d3630f34 100644 --- a/SRC/dbdsqr.f +++ b/SRC/dbdsqr.f @@ -411,12 +411,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 diff --git a/SRC/sbdsqr.f b/SRC/sbdsqr.f index 14560108..38fd1a05 100644 --- a/SRC/sbdsqr.f +++ b/SRC/sbdsqr.f @@ -410,12 +410,12 @@ 40 CONTINUE 50 CONTINUE SMINOA = SMINOA / SQRT( REAL( 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 |