PRB: Error F2112 Caused by COMPLEX Number Variable

Last reviewed: December 11, 1995
Article ID: Q39068
The information in this article applies to:
  • Microsoft FORTRAN for MS-DOS, versions 4.01, 4.1, 5.0, 5.1
  • Microsoft FORTRAN for OS/2, versions 4.1, 5.0, 5.1
  • Microsoft FORTRAN PowerStation for MS-DOS, versions 1.0 and 1.0a
  • Microsoft FORTRAN PowerStation 32 for Windows NT, version 1.0 and 4.0

SYMPTOMS

An attempt to compile an application developed in Microsoft FORTRAN fails with the following error message:

      Error F2112 : I : not symbolic constant.

With Microsoft FORTRAN PowerStation 32, version 4.0, this generates:

   error FOR3083: invalid real part of COMPLEX constant

CAUSE

A FORTRAN application cannot directly manipulate complex number variables.

RESOLUTION

Use the CMPLX intrinsic function to manipulate the variable, as follows:

   Z = CMPLX(I, 1.2)

MORE INFORMATION

On Page 24, the Microsoft FORTRAN "Language Reference and Mixed-Language Programmer's Guide" for version 4.1 describes the complex data types as follows:

   The COMPLEX or COMPLEX*8 data type is an ordered pair of single-
   precision real numbers. COMPLEX*16 data type is an ordered pair of
   double-precision real numbers. The first number in the pair represents
   the real part of a complex number, and the second number represents the
   imaginary part.

For example, the complex number (7, 3.2) represents the number 7.0+3.2i.

The following code example demonstrates this error message.

Sample Code

C Compiler options required: None

      COMPLEX*8 Z
      REAL*4 I
      Z = (I, 1.2)
      END


Additional reference words: 1.00 4.00 4.01 4.10 5.00 5.10
KBCategory: kbprg kberrmsg kbprb
KBSubcategory: FORTLngIss


THE INFORMATION PROVIDED IN THE MICROSOFT KNOWLEDGE BASE IS PROVIDED "AS IS" WITHOUT WARRANTY OF ANY KIND. MICROSOFT DISCLAIMS ALL WARRANTIES, EITHER EXPRESS OR IMPLIED, INCLUDING THE WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. IN NO EVENT SHALL MICROSOFT CORPORATION OR ITS SUPPLIERS BE LIABLE FOR ANY DAMAGES WHATSOEVER INCLUDING DIRECT, INDIRECT, INCIDENTAL, CONSEQUENTIAL, LOSS OF BUSINESS PROFITS OR SPECIAL DAMAGES, EVEN IF MICROSOFT CORPORATION OR ITS SUPPLIERS HAVE BEEN ADVISED OF THE POSSIBILITY OF SUCH DAMAGES. SOME STATES DO NOT ALLOW THE EXCLUSION OR LIMITATION OF LIABILITY FOR CONSEQUENTIAL OR INCIDENTAL DAMAGES SO THE FOREGOING LIMITATION MAY NOT APPLY.

Last reviewed: December 11, 1995
© 1998 Microsoft Corporation. All rights reserved. Terms of Use.