In Fortran 90 and later, intrinsic types such as real and integer have a. Double precision is also no longer needed and can be thought of as.
The DOUBLEPRECISION statement specifies the type to be double precision, and optionally specifies array dimensions and initializes with values.
DOUBLEPRECISIONv[/c/][,v[/c/] ...Parameter | Description |
v | Name of a symbolic constant, variable, array, array declarator, function, or dummy function |
c | List of constants for the immediately preceding name |
Description
The declaration can be: DOUBLE PRECISION or REAL*8.
DOUBLEPRECISION
For a declaration such as DOUBLEPRECISIONX, the variable X is a REAL*8 element in memory, interpreted as one double-width real number.
If you do not specify the size, a default size is used. The default size, for a declaration such as DOUBLEPRECISION X, can be altered by compiling with any of the options -dbl, -r8, or -xtypemap. See the discussion in Chapter 2 for details.
REAL*8@
For a declaration such as REAL*8 X, the variable X is always an element of type REAL*8 in memory, interpreted as a double-width real number.
Example
For example:
The IMPLICIT statement confirms or changes the default type of names.
IMPLICIT type (a[, a])[, type (a[, a])]
IMPLICIT NONE
IMPLICIT UNDEFINED(A-Z) uParameter | Description |
type | BYTEu CHARACTER CHARACTER*n (where n must be greater than 0) CHARACTER*(*) COMPLEX COMPLEX*8 u COMPLEX*16u COMPLEX*32u(SPARC only) DOUBLECOMPLEX u DOUBLEPRECISION INTEGER INTEGER*2u INTEGER*4 u INTEGER*8 u LOGICAL LOGICAL*1u LOGICAL*2u LOGICAL*4u LOGICAL*8 u REAL REAL*4u REAL*8u REAL*16u(SPARC only) AUTOMATIC u STATIC u |
a | Either a single letter or a range of single letters in alphabetical order. A range of letters can be specified by the first and last letters of the range, separated by a minus sign. |
Description
The different uses for implicit typing and no implicit typing are described here.
Implicit Typing
The IMPLICIT statement can also indicate that no implicit typing rules apply in a program unit.
An IMPLICIT statement specifies a type and size for all user-defined names that begin with any letter, either a single letter or in a range of letters, appearing in the specification.
An IMPLICIT statement does not change the type of the intrinsic functions.
An IMPLICIT statement applies only to the program unit that contains it.
A program unit can contain more than one IMPLICIT statement.
IMPLICIT types for particular user names are overridden by a type statement.
Note - Compiling with any of the options -dbl, -i2, -r8, or -xtypemap can alter the assumed size of names typed with an IMPLICIT statement that does not specify a size: IMPLICITREAL (A-Z). See Chapter 2 and the Fortran User's Guide for details.
No Implicit Typing
The second form of IMPLICIT specifies that no implicit typing should be done for user-defined names, and all user-defined names shall have their types declared explicitly.
If either IMPLICITNONE or IMPLICITUNDEFINED(A-Z) is specified, there cannot be any other IMPLICIT statement in the program unit.
Restrictions
IMPLICIT statements must precede all other specification statements.
The same letter can appear more than once as a single letter, or in a range of letters in all IMPLICIT statements of a program unit. @
The FORTRAN 77 Standard restricts this usage to only once. For f77, if a letter is used twice, each usage is declared in order. See Example 4.
Examples
Example 1: IMPLICIT: everything is integer:
Example 2: Complex if it starts with U, V, or W; character if it starts with C or S:
Example 3: All items must be declared:
In the above example, once IMPLICITNONE is specified in the beginning. All the variables must be declared explicitly.
Example 4: A letter used twice: @
In the above example, D through Z implies INTEGER, and A through C implies REAL.