Problem with NaN

Problem with NaN

  • Program Main
  • ...
  • do loop=1,n
  • call test1(...)
  • enddo
  • end Program Main
  • subroutine test1(...)
  • a=sin(2)
  • b=cos(2)
  • end subroutine test1

Here is the problem, when loop=1, both a and b got the correct value, while loop>=2, only b is correctly calculated and a=NaN. I can figure out what is the problem. Also I tried different codes, they both showed that only the frist expressioin with fortran internal function goes wrong. How to fix it..

2 posts / 0 new
Last post
For more complete information about compiler optimizations, see our Optimization Notice.

Please show us an actual and complete source that shows the problem. My experience is that paraphrases and snippets almost always omit key information.

Is test1 actually a subroutine or is it a function? If you are calling a function as a subroutine (or vice versa) you can end up with symptoms like this.  Generated interface checking usually detects this.

Steve - Intel Developer Support

Leave a Comment

Please sign in to add a comment. Not a member? Join today