Closed smalers closed 3 years ago
I changed the compile options to:
FCFLAGS = -g -cpp -fno-align-commons -static -fbounds-check -fno-automatic -finit-local-zero -fbacktrace -ffpe-trap=invalid,zero,overflow,underflow,denormal
This identified an issue on line 1512 of statecu.for
, dividing by zero ttacre
Some dataset files had NaN
and 0.0
that were resulting in divide by zero, but strangely did not cause an immediate issue...in some cases only resulting in an error after the full run completed. The following illustrates how NaN
can e detected when read from an input file: Something like this may be needed if using NaN
in input files for missing data or to catch as a fallthrough.
! Program to test reading a NaN from disk
program nantest
USE, INTRINSIC :: IEEE_ARITHMETIC, ONLY: IEEE_IS_NAN
implicit none
real f1, f2
integer IERR
OPEN (UNIT=1,FILE='data.txt',STATUS='OLD',IOSTAT=IERR)
IF (IERR.NE.0) CALL MYEXIT(1)
read(1,100) f1, f2
100 format(f8.0,f8.0)
write(*,*) 'Values read =', f1, f2
if (ieee_is_nan(f1) ) then
write(*,*) 'Detected first value is NaN'
endif
if (ieee_is_nan(f2) ) then
write(*,*) 'Detected second value is NaN'
endif
CLOSE(1)
end
subroutine MYEXIT(status)
integer status
write(*,*) 'Error=',status
return
end
Use a data file with (8 characters for each value):
1.0 NaN
Compile with: gfortran nantest.for -o nantest.exe
Then run nantest
.
I'm closing this issue. It is similar to issue #15, which has been resolved.
At the end of running the CDSS gm2015 dataset, get:
Note: The following floating-point exceptions are signalling: IEEE_INVALID_FLAG