With constants of nature (such as ) and physical conversion factors (like the number of pounds in a kilogram) it can save typing effort and reduce the risk of error if the actual number is only given once in the program and the name used everywhere else:

REAL PI, TWOPI, HALFPI, RTOD PARAMETER (PI = 3.14159265, TWOPI = 2.0 * PI) PARAMETER (HALFPI = PI / 2.0, RTOD = 180.0 / PI)The names

Another important application of named constants is for items which are not permanent constants but parameters of a program, i.e. items fixed for the present but subject to alteration at some later date. Named constants are often used to specify array bounds, character-string lengths, and so on. For example:

INTEGER MAXR, MAXC, NPTS PARAMETER (MAXR = 100, MAXC = 500, NPTS = MAXR*MAXC) REAL MATRIX(MAXR,MAXC), COLUMN(MAXR), ROW(MAXC)The constants such as

IF(NCOL .GT. MAXC .OR. NROW .GT. MAXR) THEN STOP 'Matrix is too small' ELSE MATRIX(NROW,NCOL) = ROW(NCOL) END IFIf, at some point, the matrix turns out to be too small for your needs then you only have to alter this one

The rules for character assignment apply to `PARAMETER`
statements: see section 7.4. In addition a special length
specification of `*(*)` is permitted which means that the length of
item is set to that of the literal constant. The type specification
must precede the `PARAMETER` statement.

CHARACTER*(*) LETTER, DIGIT, ALPNUM PARAMETER (LETTER = 'ABCDEFGHIJKLMNOPQRSTUVWXYZ', $ DIGIT = '0123456789', ALPNUM = LETTER // DIGIT) CHARACTER WARN*(*) PARAMETER (WARN = 'This matrix is nearly singular')The constant ALPNUM will be 36 characters long and contain all the alpha-numeric characters (letters and digits).

Named logical constants also exist, but useful applications for them are somewhat harder to find:

PARAMETER (NX = 100, NY = 200, NZ = 300, NTOT = NX*NY*NZ) LOGICAL LARGE PARAMETER (LARGE = (NTOT .GT. 1000000) .OR. (NZ .GT. 1000))