www.delorie.com/gnu/docs/gcc/g77_406.html   search  
Buy the book!

Using and Porting GNU Fortran

[ < ] [ > ]   [ << ] [ Up ] [ >> ]         [Top] [Contents] [Index] [ ? ] DCmplx Intrinsic

DCmplx(X, Y)

DCmplx: COMPLEX(KIND=2) function.


Y: INTEGER or REAL; OPTIONAL (must be omitted if X is COMPLEX); scalar; INTENT(IN).

Intrinsic groups: f2c, vxt.


If X is not type COMPLEX, constructs a value of type COMPLEX(KIND=2) from the real and imaginary values specified by X and Y, respectively. If Y is omitted, `0D0' is assumed.

If X is type COMPLEX, converts it to type COMPLEX(KIND=2).

Although this intrinsic is not standard Fortran, it is a popular extension offered by many compilers that support DOUBLE COMPLEX, since it offers the easiest way to convert to DOUBLE COMPLEX without using Fortran 90 features (such as the `KIND=' argument to the CMPLX() intrinsic).

(`CMPLX(0D0, 0D0)' returns a single-precision COMPLEX result, as required by standard FORTRAN 77. That's why so many compilers provide DCMPLX(), since `DCMPLX(0D0, 0D0)' returns a DOUBLE COMPLEX result. Still, DCMPLX() converts even REAL*16 arguments to their REAL*8 equivalents in most dialects of Fortran, so neither it nor CMPLX() allow easy construction of arbitrary-precision values without potentially forcing a conversion involving extending or reducing precision. GNU Fortran provides such an intrinsic, called COMPLEX().)

See section Complex Intrinsic, for information on easily constructing a COMPLEX value of arbitrary precision from REAL arguments.

  webmaster     delorie software   privacy  
  Copyright 2003   by The Free Software Foundation     Updated Jun 2003