Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations strongm on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

overflow error

Status
Not open for further replies.

shasa

Programmer
Aug 14, 2010
17
IR
hi
i am working a complicate complex matrix elemnet,i must run that for diffrent dimenssion of matrix, find its invers and determinant after that mutiply 2 matrix and at last find the maximum!

for each matrix element i have a summation ,and 2 function. implimenting for low dimensions like 2-5 although it take so much time but finally i gain data but for more dimension i have over flow error ,i change the step size of summation but it decrese the accuracy of my last data:(

does any one have any solution?

 
First of all, could you provide the exact error message without interpreting it please. Give also the right case (chiral number,U) involving the crash. I tested the couple (3,5) without trouble with the compiler ifort-11.1

I also read your main program but I have a problem with your DO WHILE statements.

Most (all ?) of them should be replaced by simple DO statements using an integer index. Those which are testing integer values are easy to translate, when the other ones are possibly wrong.

For instance :

Code:
QY=0
DO WHILE (QY<=4.2)
  ...
  QY=QY+0.02
ENDDO

Do you really know how many times that loop will be executed ? If yes then your are very optimistic : you seem to ignore floating point rounding errors. For example, a number like 0.02 has not an exact representation on most of computers. And I bet that summing it 210 times does not provide exactly the result 4.2. If the sum is less that 4.2, you will execute the loop 211 times else only 210.

Code:
PROGRAM t
  dx=0.02
  s=0
  DO i=1,210
    s=s+dx
  ENDDO
  write(*,*) s
END PROGRAM

Result : 4.199997 => your DO WHILE will be executed 211 times. This is possibly want you wanted but, in that case, it just means that you are lucky.

Really, you should write it, for instance, as follows :

Code:
REAL :: qy
INTEGER :: iqy
qy=0
DO iqy=0,210
  qy=iqy/50. ! do no forget the .
  ...
ENDDO

In any case, be careful with conditions involving real values...

Few other comments :
- 10**(-40) is a constant which is usually written 1.E-40
- do not use tabulations in a source file : your program appears horrible with my text editor where each tabulation replaced by 8 spaces.

 
TNX FOR YOUR ANSWER

FIRST OF ALL THIS IS THE EXACT ERROR THAT I HAVE:run-time error M6104:MATH-floating -point error:eek:verflow

MOREOVER i replaced dowhile statements to do loops but i get the wrong error!

actually i know that its loop r too larg but that must be taken even with more steps.the write amount of u is around 2.2-3.besides in the last code that u wrote would u plz tell me why the dot is important?(is it for translating integer 2 real?)


 
You should activate the all debugging flags of your compiler to locate precisely the instruction where the trouble occurs.

After that, print array indexes and values before that line and try to explain what happens.

If you cannot find explanation, and as you use linear solvers in your program, it is possible that simple precision is not enough. Try double precision.

About the dot : 1/50 and 1/50. are not at all identical, the first operation returning 0 (integer value) and the second one 0.02.
 
tnx so much for your attention

how i can use double precision,and activate the debugging flag?
 
I don't know the compiler you use. Here is a collection of flags I use with various compilers :

g95/gfortran on Linux or Windows :
Code:
-g -fbounds-check -Wall

intel ifort Linux:
Code:
-g -C -ftrapuv -traceback -fp-stack-check -fmath-errno -warn all -WB

intel ifort windows :
Code:
/Zi /debug:all /CB /fpe:0

nag Linux/windows :
Code:
-g -nan -C=all

For double precision, you have to change the declaration of real values everywhere :

Code:
REAL x(...)
must be replaced by
Code:
DOUBLE PRECISION x(...)

In addition, you must change contants : 3. -> 3.d0 or 1.e4 -> 1.d4 (the exponent symbol is D in place of E).

Insert IMPLICIT NONE at the top of each module or subroutine : you will be sure not to forget something.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top