>>770 thanks. infinity は NaN ではなかった。小手先の工夫で program test real(8) :: x,y x=0. y=0. x=x/y if(x-x.ne.0.) then write(*,*) x else write(*,*) x-x endif end を考えたのですが gfortran は NaN を返し、ifort は 0.000000000000000E+000 を, ifort -O0 は NaN を返しました。例外をトラップしようと思うと、 c のプログラムをリンクせざるとえないのかな。