Intel® Fortran Compiler
Build applications that can scale for the future with optimized code designed for Intel® Xeon® and compatible processors.

Problem with NaN

Bob_G_
Beginner
381 Views
  • 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..

0 Kudos
1 Reply
Steven_L_Intel1
Employee
381 Views

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.

0 Kudos
Reply