undefined reference to 'isnan_'

I have a couple places in my code to check for NAN values using the ‘isnan()’ function. I am porting this code from Intel compiler for Windows to PGI fortran for Linux. I have been able to make all other code changed needed for compatibility, but this error message remains and I cannot figure out how to rectify it. I am given the exact line of the file that causes the message and the subroutine within which it was placed.

At the beginning of the subroutine, I am declaring ‘logical isnan’, yet I still get the message. I show below how I am using the function.

    do i=1,ncells
      if(isnan(var(i)))then
        write(nunit,'(F8.0)') -999.0
      else
        write(nunit,'(F12.6)') var(i)
      endif
    enddo

Can anyone advise what I might be doing wrong? Thanks

Hi mebrown998,

“isnan” is a non-standard extension which we don’t support. Instead, you can try using the F2003 elemental function “ieee_is_nan”. For example:

    
   ...
   use ieee_arithmetic
   ....

   do i=1,ncells
      if(ieee_is_nan(var(i)))then
        write(nunit,'(F8.0)') -999.0
      else
        write(nunit,'(F12.6)') var(i)
      endif
    enddo

Hope this helps,
Mat

Thanks! that compiled the first time and seems to be working perfectly.
I appreciate the assistance.

Mitch

Does pgi fortran 8.0 support the ieee_arithmetic module…?^^a

Hi cyFeng,

Sorry, no. ieee_arithmatic was first supported in the 2010 compilers.

  • Mat

Thank you, Mat.

I found the post :
http://www.pgroup.com/userforum/viewtopic.php?t=614&postdays=0&postorder=asc&highlight=isnan&start=5
May I use the logical function isnand instead in pgi fortran 8.0 ?

Hi cyFeng,

You can but just keep in mind that you’re calling the system’s C99 isnan routine which is not available on Windows.

  • Mat

I got it. Thank you, Mat :)