next up previous

3.1 Numeric Kind Parameterization     continued...

(This uses the ``entity oriented" declaration style of Fortran 90 which, in this case, condenses an INTEGER statement and a PARAMETER statement into one combined statement.) The first use of the KIND intrinsic function in the preceding example has a single precision real argument(1.0), so that the value it returns is the integer kind value for single precision real. The second instance of the KIND intrinsic has a double precision real argument (1D0), so it returns the integer kind value for double precision real. Programs that use this technique are portable, regardless of the kind values chosen by the implementation

Type COMPLEX uses the same KIND values as does type REAL-the complex kind is really the kind of the real/imaginary parts-and there is a complex kind for each real kind supported by the implementation. Thus

COMPLEX(SINGLE)     ...single precision complex variables...
COMPLEX(DOUBLE)     ...double precision complex variables...
is the best manner in which to declare complex objects.

Further, if the implementation's native arithmetic is not IEEE, but it supports an IEEE data type, the integer constant IEEE could be assigned the kind value specified by the implementation for IEEE arithmetic. Then IEEE variables could be declared with:

REAL(IEEE)          ...real variables of  type  IEEE ...   
COMPLEX(IEEE)       ...complex variables  of type IEEE...