f descriptor

f descriptor


i have a question about the f discriptor in read statements. The standard format is rFw.d (r==repeat count, w==field width and d==number of digits).

If i read the chapman book correctly d is a 'nice to have' (if not present the compiler give an error) but to compiler will correct it if needed.
(eg. 00000.1501 with 1f10.2 will be read correctly as long as there is a decimal point and the number is covered by the kind of the real value).

Is this a standard behavior? or just a specific behavior form IVF?

A second question: the field width (w) value will give the part of the read statement which will be interpreted. This is fix? Only the position of the decimal point in the given field width is variable?

Thanks in advance

3 posts / 0 new
Last post
For more complete information about compiler optimizations, see our Optimization Notice.
Les Neilson's picture

On input the presence of a decimal point "overrides" the format. This is a legacy from the days of punched cards when a decimal point took up valuable space. In your example of F10.2 one could have a card with a data field of width 10 digits, which would be eight leading digits and two decimal places. The presence of a decimal point in a number meant that there would be say seven leading digits, then the point, then the two decimal digits. Or any such combination with a total width of ten characters (e.g. 5 leading characters, decimal point, 4 decimal places.)


One of the stranger consequences is that if you wish an assumed decimal point to lie to the right of the input digits, the read format must have d set to 0, e.g. f10.0

I never saw a compiler depart from the original Fortran standard treatment of f formats.

Login to leave a comment.