<Syntax> |
|
|
|
The precedence of an operator in Fortran depends only on its syntax,
and is illustrated by the table below.
Broadly speaking, the numeric operators have their usual mathematical
precedence, this is higher than all the relational operators (who have the
same precedence as each other), and this is higher than the logical operators
(which have their usual precedence).
Operators which have the same precedence are associated left-to-right except
for exponentiation (**) which is associated right-to-left.
|
|
|
|
|
|
|
Operator |
|
Precedence |
user-defined unary operators |
|
1 (highest) |
** (exponentiation) |
|
2 |
* (multiply), / (divide) |
|
3 |
unary + (positive), - (negate) |
|
4 |
binary + (add), - (subtract) |
|
5 |
// (character concatenation) |
|
6 |
.EQ. (==),
.GE. (>=), .GT. (>), .LE. (<=), .LT. (<), .NE. (/=) |
|
7 |
.NOT. |
|
8 |
.AND. |
|
9 |
.OR. |
|
10 |
.EQV., .NEQV. |
|
11 |
user-defined binary operators |
|
12 (lowest) |
|
|
|
|
|
|
<Related> |
|
|
|
.AND. operator,
Concatenation (//) operator,
.EQ. (==) operator,
.EQV. operator,
.GE. (>=) operator,
.GT. (>) operator,
.LE. (<=) operator,
.LT. (<) operator,
.NE. (/=) operator,
.NEQV. operator,
.NOT. operator,
Numeric operators,
.OR. operator |
|
|