REAL A, B, C PARAMETER (A = 3.141592654) DIMENSION B(3) DATA B /1.0, 2.0, 3.0 / DIMENSION C(100) DATA C /100*0.0/that is one variable can occur in several lines. Using Fortran 90 you can instead write

REAL, PARAMETER :: A = 3.141592654 REAL, DIMENSION(1:3) :: B = (/1.0, 2.0, 3.0 /) REAL, DIMENSION(1:100) :: C = (/ ( 0.0, I = 1, 100 ) /)The difference is not so large here but it's much larger in more complicated examples with many variables, especially since in Fortran 90 you have access to more properties. In the last example an extra parenthesis

The last example can also be generalized to assign different values to different parts of the vector.

REAL, DIMENSION(5) :: D = (/ (4.0, I = 1, 3) , (17.0, I = 4, 5) /)Since there are variables of different types there is an intrinsic function that shows the exact subtype of the variable used. This function is called

KIND (0) integer KIND (0.0) floating point number KIND (.FALSE.) logical variable KIND ("A") string of charactersThere is an intrinsic function

INTEGER, PARAMETER :: K5 = SELECTED_INT_KIND(5)This kind of integers can be used in constants according to the following line

-12345_K5 +1_K5 2_K5which is a rather unnatural specification, after the value we have to give an underscore _ followed by the name of the kind.

Use of variables of the new integer type can be declared in a nicer way

INTEGER (KIND=K5) :: IVARThe corresponding is true for floating-point variables, if we first introduce a high-precision kind

INTEGER, PARAMETER :: LONG = SELECTED_REAL_KIND(15,99)then we get the floating-point kind with at least 15 decimal digits accuracy and with an exponent range from

2.6_LONG 12.34567890123456E30_LONGand variables are declared with

REAL (KIND=LONG) :: LASSEThe old type conversions

INT(X, KIND = K5)which converts a floating-point number

REAL(Z, KIND(Z))you get it converted to a floating-point number of the real type and of the same kind of

Double precision is not included in the new Fortran 90 in any other
way than in the "old" Fortran 77, but it is assumed that the compiler
supports the double or quadruple precision that may be available in
the hardware. You can then define a suitable kind of the `REAL`, named
`DP ` or `QP`. You can of course use the old concept of `DOUBLE PRECISION`.

The reason for this rather cumbersome convention is that it is not
desirable to have too many compulsory precisions (for example single,
double, quadruple, perhaps for both the cases `REAL ` and `COMPLEX`)
and also that the old concept `DOUBLE PRECISION ` did not give a
specified machine accuracy. Now you can relatively easily specify
both which precision and which range of exponent you wish to use.
Additional information about the kind is given in Appendix 6, where
the different data types and their normal kinds for the
NAG compiler on DEC, SUN,
and the IBM PC, the
Cray compiler, and the
Absoft compiler on the Power Macintosh.

(2.1) What does the specification `LOGIC ALL ` mean?

Solution.

(2.2) Specify a constant `K` with the value `0.75`.

Solution.

(2.3) Specify an integer matrix `PELLE ` with 3 rows and 4 columns.

Solution.

(2.4) Specify a floating-point number which corresponds to the
double precision on an IBM and a single precision on Cray.

Solution.

(2.5) Specify some variables of the type above.

Solution.

(2.6) Specify some constants of the type above.

Solution.

(2.7) Is the following specification correct?

REAL DIMENSION(1:3,2:3) :: AASolution.

(2.8) Is the following specification correct?

REAL REALSolution.

(2.9) Is the following specification correct?

COMMON :: ASolution.

Last modified: 6 April 1999