As I understand it, fortran should be able to read in a NaN or Inf value. See 10.6.1.2.1 F editing in the Fortran 2003 specification. This is a new Fortran 2003 feature and is not in the Fortran 95 specification.
gfortran properly prints out the NaN values, but cannot read them in, thus causing the following program to fail: program nan_test character(15) :: nan = ' NAN -INF INF' real :: a,b,c, d = 0.0 print ('(3F5.2)'),0.0/d,-1.0/d,1.0/d read (nan,'(3F5.2)'),a,b,c print *,f end program nan_test I have tried with both 4.5.0 20100121 and 4.4.3. -- Summary: fortran library does not read in NaN -Inf or Inf Product: gcc Version: 4.5.0 Status: UNCONFIRMED Severity: normal Priority: P3 Component: libfortran AssignedTo: unassigned at gcc dot gnu dot org ReportedBy: jjcogliati-r1 at yahoo dot com http://gcc.gnu.org/bugzilla/show_bug.cgi?id=43298