Each constant, variable, array, expression, or function reference in a Fortran statement has a data type. The data type of these items can be inherent in their constructions, implied by convention, or explicitly declared.
The following data types are available in Compaq Fortran 77:
A whole number.
A floating-point number, which is a whole number, a fraction, or a combination of the two.
Similar to REAL, but has more than twice the accuracy in its representation. The G_floating double precision (VMS only) and the IEEE double precision (Alpha only) implementations also have an extended range.
Similar to REAL, but has an extended range and more than four times the accuracy in its representation.
A pair of REAL values that represent a complex number; the first value represents the real part of that number and the second represents the imaginary part.
Similar to COMPLEX; its real and imaginary parts are DOUBLE PRECISION.
A logical value, .TRUE. or .FALSE.
A string of ASCII or DEC Multinational characters.
A 1-byte storage location. It is equivalent to INTEGER*1 (and LOGICAL*1 on VAX processors).
An important attribute of each data type is the amount of memory required to represent a value of that type. Variations on the basic types affect either the accuracy of the represented value or the allowed range of values.
FORTRAN-77 defines a numeric storage unit as the amount of storage needed to represent one REAL, INTEGER, or LOGICAL value. In Compaq Fortran 77, one numeric storage unit corresponds to four bytes of memory. For example, a DOUBLE PRECISION value corresponds to 8 bytes of memory and therefore occupies two numeric storage units.
FORTRAN-77 defines a character storage unit as the amount of storage needed to represent one character value. In Compaq Fortran 77, one character storage unit corresponds to one byte of memory.
Compaq Fortran 77 provides additional data types for optimum selection of performance and memory requirements. Table 2-1 lists the data types available, the names associated with each data type, and the amount of storage required (in bytes). The form *n appended to a data type name is called a data type length specifier (for example, the *4 in REAL*4).
Type of Data | Storage Requirements (in bytes) |
---|---|
BYTE | 1 |
LOGICAL | 2, 4 or 8[1] |
LOGICAL*1 | 1 |
LOGICAL*2 | 2 |
LOGICAL*4 | 4 |
LOGICAL*8[2] | 8 |
INTEGER | 2, 4 or 8[1] |
INTEGER*1 | 1 |
INTEGER*2 | 2 |
INTEGER*4 | 4 |
INTEGER*8[2] | 8 |
REAL | 4 or 8[3] |
REAL*4 | 4 |
DOUBLE PRECISION | 8 |
REAL*8 | 8 |
REAL*16 | 16 |
COMPLEX | 8 or 16[3] |
COMPLEX*8 | 8 |
DOUBLE COMPLEX | 16 |
COMPLEX*16 | 16 |
CHARACTER | 1 |
CHARACTER*len | len[4] |
CHARACTER*(*) | passed-length[5] |
[1] Depending on the setting of compiler option INTEGER_SIZE,
this data type can have two, four,
or eight (Alpha only) bytes. The default
allocation is four bytes.
|