XL Fortran for AIX 8.1

Language Reference

How Expressions Are Evaluated

Precedence of Operators

An expression can contain more than one kind of operator. When it does, the expression is evaluated from left to right, according to the following precedence among operators:

  1. Defined unary
  2. Arithmetic
  3. Character
  4. Relational
  5. Logical
  6. Defined binary

For example, the logical expression:

L .OR. A + B .GE. C

where L is of type logical, and A, B, and C are of type real, is evaluated the same as the logical expression below:

L .OR. ((A + B) .GE. C)

An extended intrinsic operator maintains its precedence. That is, the operator does not have the precedence of a defined unary operator or a defined binary operator.

Summary of Interpretation Rules

Primaries that contain operators are combined in the following order:

  1. Use of parentheses
  2. Precedence of the operators
  3. Right-to-left interpretation of exponentiations in a factor
  4. Left-to-right interpretation of multiplications and divisions in a term
  5. Left-to-right interpretation of additions and subtractions in an arithmetic expression
  6. Left-to-right interpretation of concatenations in a character expression
  7. Left-to-right interpretation of conjunctions in a logical term
  8. Left-to-right interpretation of disjunctions in a logical disjunct
  9. Left-to-right interpretation of logical equivalences in a logical expression

Evaluation of Expressions

Arithmetic, character, relational, and logical expressions are evaluated according to the following rules:

+-------------------------------IBM Extension--------------------------------+

Several compiler options affect the data type of the final result:

See "XL Fortran Compiler-Option Reference" in the User's Guide for information about compiler options.

+----------------------------End of IBM Extension----------------------------+

+-------------------------------IBM Extension--------------------------------+

Using BYTE Data Objects

Data objects of type BYTE can be used wherever a LOGICAL(1), CHARACTER(1), or INTEGER(1) data object can be used.

The data types of BYTE data objects are determined by the context in which you use them. XL Fortran does not convert them before use. For example, the type of a named constant is determined by use, not by the initial value assigned to it.

+----------------------------End of IBM Extension----------------------------+

[ Top of Page | Previous Page | Next Page | Table of Contents | Index ]