×
INTELLIGENT WORK FORUMS
FOR COMPUTER PROFESSIONALS

Log In

Come Join Us!

Are you a
Computer / IT professional?
Join Tek-Tips Forums!
  • Talk With Other Members
  • Be Notified Of Responses
    To Your Posts
  • Keyword Search
  • One-Click Access To Your
    Favorite Forums
  • Automated Signatures
    On Your Posts
  • Best Of All, It's Free!
  • Students Click Here

*Tek-Tips's functionality depends on members receiving e-mail. By joining you are opting in to receive e-mail.

Posting Guidelines

Promoting, selling, recruiting, coursework and thesis posting is forbidden.

Students Click Here

Jobs

overflow error

overflow error

overflow error

(OP)
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?

RE: overflow error

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.

 

RE: overflow error

(OP)
TNX FOR YOUR ANSWER

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

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?)


 

RE: overflow error

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.

RE: overflow error

(OP)
tnx so much for your attention

how i can use double precision,and activate the debugging flag?

RE: overflow error

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.

RE: overflow error

(OP)
tnx so much

Red Flag This Post

Please let us know here why this post is inappropriate. Reasons such as off-topic, duplicates, flames, illegal, vulgar, or students posting their homework.

Red Flag Submitted

Thank you for helping keep Tek-Tips Forums free from inappropriate posts.
The Tek-Tips staff will check this out and take appropriate action.

Reply To This Thread

Posting in the Tek-Tips forums is a member-only feature.

Click Here to join Tek-Tips and talk with other members!

Close Box

Join Tek-Tips® Today!

Join your peers on the Internet's largest technical computer professional community.
It's easy to join and it's free.

Here's Why Members Love Tek-Tips Forums:

Register now while it's still free!

Already a member? Close this window and log in.

Join Us             Close