Knowledge Base

PRB: DIM() Intrinsic Function does not Support Complex Numbers

PSS ID Number: 149749

Article Last Modified on 11/2/1999


The information in this article applies to:


This article was previously published under Q149749

SYMPTOMS

Attempting to use complex numbers as DIM() input arguments results in the following compilation error:
error FOR2325: wrong data type for argument number of intrinsic procedure DIM
The DIM() intrinsic function returns the difference between two input arguments if their difference is positive, or it returns zero otherwise. The DIM() intrinsic function no longer supports the use of complex numbers as input arguments. Note only the real part of the complex numbers is used to calculate the difference between the two input arguments.

RESOLUTION

Obtain the real part of the complex number, and use it as the DIM() intrinsic function input argument.

-or-

Compile the source file using the /4fps1 compiler option.

STATUS

This behavior is by design.

MORE INFORMATION

Sample Code to Illustrate Problem and Resolution

! Compile options needed: none

      real*8 d
      complex c1, c2
      c1 = (4.0, -1.0)
      c2 = (1.0, 4.2E3)
! comment the following line for first resolution
      d = DIM( c1, c2 )
! uncomment the following line for second resolution
!      d = DIM( real(c1), real(c2) )
      print *, d
      end
				

Additional query words: 4.00

Keywords: kbLangFortran KB149749
Technology: kbAudDeveloper kbFORTRANPower400NT kbFortranSearch kbZNotKeyword8