PRB: Incorrect Results from AIMAG of a Complex Function
PSS ID Number: Q10625
Article last modified on 07-27-1994

3.20

MS-DOS


----------------------------------------------------------------------
The information in this article applies to:

 - Microsoft FORTRAN for MS-DOS, version 3.2
----------------------------------------------------------------------

Summary:

SYMPTOMS
   An application generates incorrect results at run time.

CAUSE
   The application specifies a complex function as an argument to the
   AIMAG intrinsic function.

RESOLUTION
   Store the results of the complex function in a temporary variable
   and call the AIMAG function with the temporary variable.

STATUS
   Microsoft has confirmed this to be a problem in FORTRAN version 3.2
   for MS-DOS. This problem was corrected in FORTRAN version 3.3 for
   MS-DOS.

More Information:

The following code example demonstrates this problem.

Sample Code #1
--------------

C Compile options needed: None

      COMPLEX FUNC2
      WRITE (*, *) AIMAG(FUNC2())
      END

      COMPLEX FUNCTION FUNC2()
      FUNC2 = (1111., 2222.)
      END

The following code example demonstrates the method to avoid this
problem.

Sample Code #2
--------------

C Compile options needed: None

      COMPLEX FUNC2, ZZ

      ZZ = FUNC2()
      WRITE (*, *) AIMAG(ZZ)
      END

      COMPLEX FUNCTION FUNC2()
      FUNC2 = (1111., 2222.)
      END

Additional reference words: 3.20

=============================================================================

Copyright Microsoft Corporation 1994.
