NAGWare f77 Tools language definition

 

Index

DESCRIPTION
ANSI STANDARD FORTRAN
US MILITARY STANDARD EXTENSIONS
NAG FORTRAN 77 EXTENSIONS

 

DESCRIPTION

The target language processed by NAGWare f77 Tools consists of: The target language is accepted by all tools. The standard conformance and portability verifier (nag_pfort), however, will report on the use of all extensions to the ANSI standard.

 

ANSI STANDARD FORTRAN

The standard form of Fortran 77 is defined in the document

      ANSI  X3.9-1978  [1978].
      Programming  Language  FORTRAN.
      American National Standards Institute, New York.

 

US MILITARY STANDARD EXTENSIONS

These extensions to ANSI Fortran 77 are defined in the document

      Military Standard, Fortran,
      DOD Supplement to American Standard X3.9-1978,
      MIL-STD-1793,
      US Government Printing Office: 1978 - 603-022/5405

This document adds the following features to the language:

 

NAG FORTRAN 77 EXTENSIONS

NAGWare f77 Tools accepts symbolic names of any length rather than being limited to six characters as specified in the Fortran 77 standard. Additionally, the names may start with a letter or dollar sign and may contain letters (either case), digits, underscores ('_') and dollar signs ('$').

Case is not significant in keywords and identifiers.

An initial line of a statement may contain a tab character in the label field, the tab character implies 'tab to column 7'. A line of this form may not contain more than 72 significant characters after expansion of the tab.

Additional Data Types

NAGWare f77 Tools Target Fortran 77 recognises the following data types in addition to those defined in the standard:

  1. Double complex - double precision complex data type (DOUBLE COMPLEX or COMPLEX*16),
  2. Half-precision integer data type (INTEGER*2),
  3. Half-precision logical data type (LOGICAL*2),
  4. Quarter-precision logical data type (LOGICAL*1),
  5. Quadruple-precision real data type (REAL*16) and
  6. Hollerith data type.
Additionally, the following data types are recognised as equivalent to standard data types: The NAGWare f77 Tools understanding of the Hollerith data type follows the description in Appendix C of the Fortran 77 standard.

Double Complex

The double complex data type is analogous to the complex data type, with double precision data instead of real data. A double complex datum takes four numeric storage units.

The form of a double complex constant is similar to that of the complex constant, but either the real part or the imaginary part must be a double precision constant.

A double complex constant may appear anywhere that a complex constant would be legal.

The data type of the combination using a standard arithmetic operator of double complex with any arithmetic data type except quadruple precision real is double complex. Double complex may not be combined arithmetically with quadruple precision real.

The combination of double precision with complex produces a double complex result. Note that this is an extension of the Fortran 77 standard, which prohibits such a combination.

The following standard intrinsic functions accept a double complex argument: CMPLX, DBLE, INT, REAL, ABS, COS, EXP, LOG, SIN, SQRT. ABS returns a double precision result; COS, EXP, LOG, SIN and SQRT return double complex results.

The following additional intrinsic functions are allowed:

  1. CDABS - the specific name for ABS applied to a double complex datum,
  2. DCMPLX - creates a double complex datum. The argument may be a pair of numbers which must be integer, real or double precision, or may be a complex or double complex number.
  3. DCONJG - the double complex analogue of CONJG.
  4. DIMAG - the double complex analogue of AIMAG.
Double complex and complex variables may be initialised with double complex or complex values.

The additional features for double precision complex defined above represent commonly found extensions. These may not be acceptable to all compilers.

INTEGER*2 and REAL*16

Half precision integer and quadruple precision real may only be used for symbolic names - there are no constants of these data types.

Half-precision integer and quadruple-precision real may be used in arithmetic expressions. The result of combining half-precision integer with any other data type is that data type. The result of combining quadruple-precision real with any other data type except double complex is quadruple-precision real; quadruple-precision real must not be combined with double complex.

Half-precision integer and quadruple-precision real may also appear in DO statements (either as the controlling variable or in any of the limit expressions), i/o implied DO loops (similarly), arithmetic IF statements and in subscript expressions.

The following standard intrinsic functions will accept an half-precision integer argument: INT, REAL, DBLE, CMPLX, DCMPLX, ABS, MAX, MIN, MOD, SIGN. The following MIL-STD functions and subroutines will accept half-precision integer arguments: IOR, IAND, NOT, IEOR, ISHFT, ISHFCT, IBITS, MVBITS, BTEST, IBSET, IBCLR.

The following standard intrinsic functions will accept a quadruple-precision real argument: INT, REAL, DBLE, CMPLX, DCMPLX, NINT, ABS, COS, EXP, LOG, MAX, MIN, MOD, SIGN, SIN, SQRT, ACOS, AINT, ANINT, ASIN, ATAN, ATAN2, COSH, DIM, LOG10, SINH, TAN, TANH.

Quadruple-precision real and half-precision integer variables may be initialised in DATA statements with integer, real or double precision values. Half precision integer variables may be initialised in DATA statements with bit constants.

LOGICAL*1 and LOGICAL*2

There are no half-precision or quarter-precision logical constants - all logical constants are full precision.

The combination of logical data of differing precisions has the data type of the higher precision occurring.

Low-precision logical may in general be used as if it were full-precision logical, except for actual arguments to subprograms, which must match in precision with the receiving dummy argument.

Data Type Result Diagram
For Arithmetic Operations

----------------------------------------------------------
        I2       I       R       D       Q       C      DC
==========================================================
I2      I2       I       R       D       Q       C      DC
----------------------------------------------------------
I                I       R       D       Q       C      DC
----------------------------------------------------------
R                        R       D       Q       C      DC
----------------------------------------------------------
D                                D       Q       C      DC
----------------------------------------------------------
Q                                        Q      err     err
----------------------------------------------------------
C                                                C      DC
----------------------------------------------------------
DC                                                      DC
----------------------------------------------------------

The results are symmetric, so only half of the diagram is filled in. The changes from the Fortran 77 standard are:

- New rows/columns for I2 (INTEGER*2), Q (REAL*16) and DC (DOUBLE COMPLEX).
- Result of "D op C" is DC, not "prohibited".

Copyright, Numerical Algorithms Group, Oxford, 1991-2001