Intel fortran-80 manual is evaluated as if it were written

Models: fortran-80

1 130
Download 130 pages 742 b
Page 21
Image 21
is evaluated as if it were written

FORTRAN-SO

f'ORTRAN Concepts

Relational expressions are commonly used in the IF statement (Chapter 4).

IF (NUMB .GT. 99) STOP

IF (PNAME .EO. 'GEHRIG')PRINT 20, PNAME, AVG

2.2.4.3.2Interpretation of Arithmetic Relational Expressions. An arithmetic rela- tional expression is TRUE if the values of the operands satisfy the relational condi- tion set up by the operator, and is FALSE otherwise.

If the operands are of different types, type conversion is similar to that of arithmetic expressions. The relational expression

EXP1 operator EXP2

is evaluated as if it were written

(EXP1 - EXP2) operator 0

where '0' is the same type as (EXPI - EXP2) and 'operator' is the same relational operator in both expressions.

2.2.4.3.3Interpretation of Character Relational Expressions. A character rela- tional expression is TRUE if the values of the operands satisfy the relational condi- tion set up by the operator, and is FALSE otherwise.

If two character operands have different lengths, the shorter is 'extended' to the length of the longer by adding blanks on the right of the character string. The character expression EXP 1 is considered to be less than EXP2 if the value of EXP 1 precedes the value of EXP2 in the ASCII collating sequence, and vice versa (Appen- dix E).

2.2.4.4Logical Expressions. A logical expression performs a logical computa- tion and returns a TRUE or FALSE result of type logical. This expression can be a single logical operand (logical constant, logical variable reference, logical array ele- ment reference, logical function reference, or relational expression) or a combina- tion of logical operands joined by logical operators and parentheses.

2.2.4.4.1 Logical Operators. The logical operators are:

Operator

Meaning

.NOT.

Logical negation

.AND.

Logical conjunction

.OR.

Logical inclusive disjunction

.EQV.

Logical equivalence

.NEQV.

Logical nonequivalence

2.2.4.4.2Value and Length of Logical Expressions. The value of a logical operand involving .NOT. is as follows:

OP1

.NOT.OP1

TRUE FALSE

FALSE TRUE

The logical expression has the opposite value as its operand.

2-9

Page 21
Image 21
Intel fortran-80 manual is evaluated as if it were written