2.1 Data Types

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:

Storage Requirements

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).

Table 2-1 Data Type Storage Requirements

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 
REAL*8  8 
REAL*16   16 
COMPLEX  8 or 16[3] 
COMPLEX*8  8 
DOUBLE COMPLEX  16 
COMPLEX*16  16 
CHARACTER 
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.
[2] Alpha only
[3] On Alpha processors, the setting of compiler option REAL_SIZE causes REAL to have four or eight bytes and COMPLEX to have eight or sixteen bytes. The default allocations are four bytes for REAL and eight bytes for COMPLEX.
[4] The value of len is the number of characters specified, which can be in the range 1 to 65535 (VMS only) or 1 to 2**31-1 (U*X).
[5] The passed-length format *(*) applies to dummy arguments, PARAMETER statements, or character functions, and indicates that the length of the actual argument or function is used. (See Section 6.1.1.4 and your user manual.)

For More Information:


Previous Page Next Page Table of Contents