In accordance with Fortran 90 and at least some (perhaps all)
other compilers, the GNU Fortran language defines
as always returning a result that is type
DOUBLE PRECISION), is treated as:
(It was necessary for Fortran 90 to specify this behavior
DOUBLE PRECISION arguments, since that is
the behavior mandated by FORTRAN 77.)
The GNU Fortran language also provides the
which is provided by some FORTRAN 77 compilers to construct
DOUBLE COMPLEX entity from of
However, this solution does not scale well when more
(having various precisions and ranges) are offered by Fortran implementations.
Fortran 90 extends the
CMPLX() intrinsic by adding
an extra argument used to specify the desired kind of complex
However, this solution is somewhat awkward to use, and
g77 currently does not support it.
The GNU Fortran language provides a simple way to build a complex value out of two numbers, with the precise type of the value determined by the types of the two numbers (via the usual type-promotion mechanism):
When real and imag are the same
performs no conversion other than to put them together to form a
complex result of the same (complex version of real) type.
See Complex Intrinsic, for more information.