NaNは0.0/0.0(0割る0)の結果と定義されます (参考)
ifortの場合、floating invalidというエラーがでます。
テスト環境:ifort (IFORT) 11.1
プログラム例
program isnan_test! Description:!! Author: am!! Host: aofd30! Directory: /work2/am/12.Work11/22.Climatology_2/43.SW_penetration/isnan_test!! Revision history:! This file is created by /usr/local/mybin/nff.sh at 18:03 on 09-13-2011. USE, INTRINSIC :: IEEE_ARITHMETIC! implicit none real VALUE integer K! write(*,'(a)')'Program isnan_test starts.'! write(*,*)'' K1 = ( IEEE_IS_NAN( 0.0/0.0 ) ) K2 = ( IEEE_IS_NAN( 1.0/0.0 ) ) K3 = ( IEEE_IS_NAN( 1.0/1.0 ) ) print *,'K1=',K1 print *,'K2=',K2 print *,'K3=',K3! write(*,'(a)')'Done program isnan_test.'! write(*,*)end program isnan_test実行例
$ ./isnan_test
K1= -1
K2= 0
K3= 0
real 0m0.002s
user 0m0.001s
sys 0m0.001s
参考
http://software.intel.com/en-us/forums/showthread.php?t=63080