[SaDPhIG] Fortran help

Alex Del Giudice delgiudice at ling.ucsd.edu
Wed Nov 18 14:31:34 PST 2009


For those of you who might know someone who knows Fortran.

I'm trying to figure out how to input data into a Fortran program.  I need to inform the program what the format of the input data is.  This is done by starting the input file with a line that looks like this:

(xFy.z)

x = an integer, I think it is telling the program how many items per line that it should look for.
F = stands for "floating point number"
y = an integer, I'm not sure what this is.  Maybe it stands for the largest number of total digits in each item
z = an integer, I'm 99.9% sure this tells the program the number of integers  after the decimal point

So if I write this line at the beginning of my input file:

(2F5.2)

I am telling the program that each of the following lines contains 2 floating point integers (none of which will consist of more than 5 digits) and after each decimal point there are going to be no more than 2 digits.  So the next few lines would look something like this:

 10.22  1.31
 22.18  3.50
131.01 51.14

but could not look like any of these:

   3      6
12.1  1.222
   3    4.1   5.5

At least one of my assumptions about what x and y actually do must be wrong, because the program crashes when it tries to read the input data.  So my question is "what do the integers in position x and y actually stand for?"

thanks in advance for any help.
Alex



More information about the SaDPhIG mailing list