Fortran Format Statements

The following text is copied from http://www.cs.mtu.edu/~shene/COURSES/cs201/NOTES/chap05/format.html

Format Edit Descriptors

The tedious part of using Fortran format is to master many format edit descriptors. Each edit descriptor tells the system how to handle certain type of values or activity. Each value requires some positions. For example, an integer of four digits requires at least four positions to print. Therefore, the number of positions to be used is the most important information in an edit descriptor. We shall use the following convention of symbols:
  • w: the number of positions to be used
  • m: the minimum number of positions to be used
  • d: the number of digits to the right of the decimal point
  • e: the number of digits in the exponent part
Although we may print a number using as many positions as you want, this is only for input/output. This number of positions is not the precision (i.e., the number of significant digits) of that number. To be more precisely, computers normally can store real numbers up to seven significant digits. This is the precision of real numbers. However, we can print a real number using 50 positions in which 25 positions are for the fraction part. This is only a way of describing the appearance and does not change the precision of real numbers. The following are the editor descriptors to be discussed. Details will be given on subsequent pages.

Purpose
Edit Descriptors
Reading/writing INTEGERs
Iw
Iw.m
Reading/writing REALs
Decimal form
Fw.d
Exponential form
Ew.d
Ew.dEe
Scientific form
ESw.d
ESw.dEe
Engineering form
ENw.d
ENw.dEe
Reading/writing LOGICALs
Lw
Reading/writing CHARACTERs
A
Aw
Positioning
Horizontal
nX
Tabbing
Tc
TLc and TRc
Vertical
/
Others
Grouping
r(....)
Format Scanning Control
:
Sign Control
S, SP and SS
Blank Control
BN and BZ

No comments: