I am having trouble reading exponential from a text file using Fortran.
The entry in the text file looks like the following
0.02547163e+06-0.04601176e+01 0.02500000e+02 0.00000000e+00 0.00000000e+00 3
And the code that I am using looks like the following
read(iunit,'(ES20.8,ES20.8,ES20.8,ES20.8,ES20.8,I2)') dummy1, dummy2, Thermo_DB_Coeffs_LowT(iS,1:3),temp
The error I am getting is
Fortran runtime error: Bad value during floating point read
How can I read these values?
sed) to put spaces into the file where f-p values have run together, then read with list-directed input. - High Performance Mark15.8. also I don't thinkSdoes anything on input, so justE15.8. And go have a talk with whoever created such file with numbers run together with no delimiters - agentpESis treated just like input withE. This is further treated likeF. Also, you should prefer not to useF15.8butF15.0(or whatever field width). - francescalusreading should be avoided - it offers nothing and can only cause trouble, depending on the data to be read. I agree with HPF, the data file needs to be modified (bysedor a macro in an editor), so that it will separate numbers with spaces (one space would be enough, but you can add more, it doesn't really matter). Thenread(iunit,*)will just do the job perfectly. While I always use formatted printing, I really can't see any reason to use formatted reading, other than looking for potential trouble. - Pap