 |
» |
|
|
 |
Declares entities
of type real. SyntaxREAL [kind-spec] [[, attrib-list] ::] entity-list |
 |
- kind-spec
is the kind type parameter that specifies the range
and precision of the entities in entity-list. kind-spec takes the form: ([KIND=]kind-param) where kind-param can be a named constant or a constant expression
that has the integer value of 4, 8, or 16. The size of the default
type is 4. As an extension, kind-spec can take the form: * len-param where len-param is the integer 4, 8, or 16 (default = 4). - attrib-list
is a list of one or more of the following attributes,
separated by commas: Table 10-48 Title not available (REAL) ALLOCATABLE | INTRINSIC | PRIVATE | DIMENSION | OPTIONAL | PUBLIC | EXTERNAL | PARAMETER | SAVE | INTENT | POINTER | TARGET |
If attrib-list is present, it must be followed by the double colon.
For information about individual attributes, see the corresponding
statement in this chapter. - entity-list
is a list of entities, separated by commas. Each
entity takes the form: name [( array-spec )] [ = initialization-expr ] where name is the name of a variable or function, array-spec is a comma-separated list of dimension bounds, and initialization-expr is a real constant expression. If initialization-expr is present, entity-list must be preceded by the double colon.
DescriptionThe REAL statement is used to declare the length and properties
of data that approximate the mathematical real numbers. A kind parameter
(if present) indicates the representation method. The REAL statement is constrained by the rules for all
type declaration statements, including the requirement that it precede
all executable statements. As a portability
extension, HP Fortran allows the following syntax for specifying
the length of an entity: name [*len] [( array-spec )] [= initialization-expr] |
If (array-spec) is specified, *len may appear on either side of (array-spec). If name appears with *len, it overrides the length specified by REAL*size. ExamplesThe following are valid declarations: REAL, TARGET :: x, y REAL(KIND=16) :: z REAL(4), PARAMETER :: pi=3.14 ! initialize an array, using an array constructor REAL, DIMENSION(4) :: rvec=(/ 1.1,2.2,3.3,4.4 /) ! use the slash notation (an HP extension) to initialize REAL x/2.87/, y/93.34/, z/13.99/ ! note, no double colon ! the following declarations are equivalent; the second uses the ! HP length specification extension REAL (KIND = 8) x REAL*4 x*8 |
Related statementsDOUBLE PRECISION Related conceptsFor related information, see the following:
|