A constant expression is made up of explicit constants and parameters and the FORTRAN operators. Each operand is either itself another constant expression, a constant, a symbolic name of a constant, or one of the intrinsic functions called with constant arguments.
PARAMETER (L=29002), (P=3.14159), (C='along the ') PARAMETER ( I=L*2, V=4.0*P/3.0, S=C//'riverrun' ) PARAMETER ( M=MIN(I,L), IA=ICHAR('A') ) PARAMETER ( Q=6.4Q6, D=2.3D9 ) K = 66 * 80 VOLUME = V*10**3 DO I = 1, 20*3
There are a few restrictions on constant expressions:
Constant expressions are permitted wherever a constant is allowed, except they are not allowed in DATA or standard FORMAT statements.
Constant expressions are permitted in variable format expressions. @
Exponentiation to a floating-point power is not allowed; a warning is issued.
demo% cat ConstExpr.f parameter (T=2.0*(3.0**2.5)) write(*,*) t end demo% f77 ConstExpr.f ConstExpr.f: MAIN: "ConstExpr.f", line 1: Warning: parameter t set to a nonconstant demo% a.out 31.1769 demo%