Real value from namelist reads as integer
Alexander Varnin
fenixk19@mail.ru
Tue Nov 23 22:51:00 GMT 2010
Hello. I'm reading namelist from file with an old program (it is still
uses labels, fixed-form, etc). Namelist contains
&NLMAIN
DT=7.3000002E-011,
...
&END
But when i read, and immediately write namelist to stdout, i get
&NLMAIN
DT= 7.0000000 ,
...
/
For some reason DT get read as integer, not as real.
I've written test, where I've used the same input file and namelist
description. It just reads and writes namelist(or DT value), and
everything works fine. It means, that the problem is in the program, not
in namelist format. But i have no idea, what is responsible for it,
because I've tried to move everything namelist related to my test, and
test works fine.
That how i read namelist:
KUNIT=55
open( kunit, file=FN_FORT(1:strlen(FILENAME)))
...
READ(KUNIT,NLMAIN)
write(*, nlmain)
Namelist declared as
NAMELIST/NLMAIN/TT,DT,IT
...
More information about the Fortran
mailing list