Search code examples
fortran77

Format specifier in Fortran


Fortran question: Which is the correct format statement, format('CRDET',2i5,1p3e12.4) or format('CRDET',2i5,1p,3e12.4)? The difference is the comma separator between the last two arguments.


Solution

  • Going out on a limb, reading standards but not testing it.. It seems both forms are the same and the P applies to all 3 of the E's

    1) It (P) applies to all subsequently interpreted F, E, D, and G edit descriptors until another scale factor is encountered,

    2) The comma used to separate list items in the list flist may be omitted as follows:
    ** Between a P edit descriptor and an immediately following F, E, D, or G edit descriptor

    I suppose the comma form is safer as its not clear if the repeated edit descriptor falls under point 2..