24.11.2014 Views

Open Watcom FORTRAN 77 Language Reference

Open Watcom FORTRAN 77 Language Reference

Open Watcom FORTRAN 77 Language Reference

SHOW MORE
SHOW LESS

Create successful ePaper yourself

Turn your PDF publications into a flip-book with our unique Google optimized e-Paper software.

<strong>Language</strong> <strong>Reference</strong><br />

where:<br />

relop<br />

is a relational operator.<br />

e1, e2 are both arithmetic expressions or both character expressions.<br />

7.3.2.1 Arithmetic Relational Expressions<br />

An arithmetic relational expression is a relational expression in which e1 and e2 are both arithmetic<br />

expressions. An arithmetic relational expression has a value of true if the operands satisfy the relation<br />

specified by the relational operator and false otherwise.<br />

A complex operand is only permitted when using either the .EQ. or .NE. relational operators.<br />

<strong>Watcom</strong> <strong>FORTRAN</strong> <strong>77</strong> allows operands of type COMPLEX*16.<br />

<strong>Open</strong><br />

7.3.2.2 Character Relational Expressions<br />

Character relational expressions are relational expressions whose operands are of type CHARACTER.<br />

The value of a relation between character strings is established by using the collating sequence of the<br />

processor character set. The collating sequence is an ordering of the characters in the processor character<br />

set. Note, for example, that the EBCDIC character set has a different collating sequence than that of the<br />

ASCII character set. For example, e1 is greater than e2 if the value of e1 follows the value of e2 in the<br />

processor collating sequence. The value of a character relational expression depends on the collating<br />

sequence. In the case of the .NE. and .EQ. operators, the collating sequence has no effect.<br />

Example:<br />

IF( ’A’ .LT. ’a’ )THEN<br />

PRINT *, ’The processor character set’<br />

PRINT *, ’appears to be ASCII’<br />

ELSE<br />

PRINT *, ’The processor character set’<br />

PRINT *, ’appears to be EBCDIC’<br />

END IF<br />

END<br />

The above example is a crude test for determining the character set used on your processor.<br />

It is possible to have operands of unequal length. In this case, the character string of smaller length is<br />

treated as if blanks were padded to the right of it to the length of the larger string. The relational operator is<br />

then applied.<br />

7.4 Logical Expressions<br />

Logical expressions are used to describe computations involving operands whose type is LOGICAL or<br />

INTEGER , logical operators and left and right parentheses. The result of the computation is of type<br />

LOGICAL unless both operands are of type INTEGER in which case the result of the computation is of<br />

type INTEGER.<br />

180 Logical Expressions

Hooray! Your file is uploaded and ready to be published.

Saved successfully!

Ooh no, something went wrong!