- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Please help me understand the difference between format statements 102 and 103 below. I thought format statement 102 had an unnecessary extra set of parentheses, but not true. The added parentheses significantly change the interpretation of the two format statements. (Format 102 is printing in the format I desire.) Please help me understand how the added parentheses in 102 are working to change the meaning of the format.
write (intOutFile, 102) (i, dblNodeStaArray(i), dblSpanFraArray(i), dblNodeDepthArray(i), dblNodeTopRefArray(i), i = 1, intNumNodes)
102 format ((i6, 1x, 4(2x, f15.3)))
1 0.000 1.000 93.000 10.000
2 27.000 1.010 93.000 10.000
3 54.000 1.020 93.000 10.000
4 81.000 1.030 93.000 10.000
write (intOutFile, 103) (i, dblNodeStaArray(i), dblSpanFraArray(i), dblNodeDepthArray(i), dblNodeTopRefArray(i), i = 1, intNumNodes)
1 0.000 1.000 93.000 10.000
0.000 27.000 1.010 93.000
10.000 0.000 54.000 1.020
93.000 10.000 0.000 81.000
1.030 93.000 10.000 0.000
Link Copied
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
See Dr. Fortran's article, https://software.intel.com/en-us/blogs/2009/07/01/doctor-fortran-in-revert-revert-the-end-of-the-format-is-nigh , and note this excerpt from Clive Page's "Professional Programmer's Guide to Fortran 77", http://www.star.le.ac.uk/~cgp/prof77.html (near the end of section 10.9) :
If the format list is exhausted when there are still more items in the data-transfer list then forced reversion occurs: the file is positioned at the beginning of the next record and the format list is scanned again, starting at the left-parenthesis matching the last preceding right-parenthesis. If this is preceded by a repeat-count then this count is re-used. If there is no preceding right-parenthesis then the whole format is re-used.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Thank you very much for the quick and clear response and the links to the references.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Something else about those two format specifications may be worth noting. The use of F15.3 hides something quite serious. The values printed for i, i=2,4 are all 0.000. You may wish to see what gets printed if you were to replace F15.3 by, say, E15.3. Small integers, interpreted as reals, are seen as denormalized numbers, i.e., reals that are less than TINY(1e0)
- Subscribe to RSS Feed
- Mark Topic as New
- Mark Topic as Read
- Float this Topic for Current User
- Bookmark
- Subscribe
- Printer Friendly Page