02.07.2013 Views

HP Fortran Programmer's Reference

HP Fortran Programmer's Reference

HP Fortran Programmer's Reference

SHOW MORE
SHOW LESS

Create successful ePaper yourself

Turn your PDF publications into a flip-book with our unique Google optimized e-Paper software.

<strong>HP</strong> <strong>Fortran</strong> statements<br />

PARAMETER (statement and attribute)<br />

The type of a named constant is determined by the implicit typing rules, unless its type is<br />

specified by a type declaration statement prior to its first appearance in a PARAMETER<br />

statement or by a type declaration statement that includes PARAMETER as one of its attributes.<br />

If a PARAMETER statement declares and implicitly types a named constant, the named constant<br />

may appear in a subsequent type declaration or IMPLICIT statement, but only to confirm the<br />

type of the named constant.<br />

When the type of the symbolic name and the constant do not agree, the value of the named<br />

constant is assigned in accordance with assignment statement type-conversion rules, as given<br />

in Table 5-5.<br />

The following rules apply to type agreement between the constant and the symbolic name:<br />

If cname is of numeric type, cexpr must be an arithmetic constant expression.<br />

If cname is of type character, the corresponding cexpr must be a character constant<br />

expression.<br />

If cname is of type logical, the corresponding cexpr may be either an arithmetic or logical<br />

constant expression.<br />

Any symbolic name of a constant that appears in cexpr must have been defined previously in<br />

thesameoradifferentPARAMETER statement in the same program unit. For example, the<br />

expression in the second PARAMETER statement below is built from the expression in the first<br />

PARAMETER statement, and is legal:<br />

PARAMETER (limit = 1000)<br />

PARAMETER (limit_plus_1 = limit + 1)<br />

The logical operators (.EQ., .NE., .LT., .LE., .GT., and.GE.), as well as the following<br />

intrinsic functions, can appear in the PARAMETER statement:<br />

Table 10-43<br />

ABS IAND IXOR MAX<br />

CHAR ICHAR LEN MIN<br />

CMPLX IEOR LGE MOD<br />

CONJB IMAG LGT NINT<br />

DIM IOR LLE NOT<br />

DPROD ISHFT LLT<br />

If these intrinsic functions are used in a PARAMETER statement, their arguments must be<br />

constants.<br />

Chapter 10 387

Hooray! Your file is uploaded and ready to be published.

Saved successfully!

Ooh no, something went wrong!