more on catching Nan and inf on the fly

Hi All,

I have discovered that I need to check if certain values have NaN or inf values on the fly. A command like this works if the -Kieee flag is used:


But compiling the entire code with the -Kieee flag results in very slow performance. The PGI intrinsics isnand and isinfd work great, but gfortran does not know these commands.

I give this code out to students for use in class, and I want the code to be portable, if possible. I also want to have a single command line to compile the code, if possible. I can make a subroutine that invokes the above check with the if statement. Is it possible to have the compiler apply certain compiler flags to specific subroutines? If so, then I can have the -Kieee flag apply only to the simple routine that checks for NaNs and infs.



-Kieee is a compile time option only, so individual files can be compiled
w/wo -Kieee . Doing it on a per module basis inside a file is not that easy.

The objects generated do not name-conflict with non-Kieee compiled