FORTRAN Reference Manual

Expressions
FORTRAN Reference Manual528615-001
3-2
Arithmetic Expressions
Arithmetic Expressions
The combination of arithmetic operands and operators makes up an arithmetic
expression. An arithmetic expression expresses a numeric computation; the evaluation
of an arithmetic expression produces a numeric value.
The syntax of an arithmetic expression is:
prefix-op
is one of
+
-
item
is a variable, constant, symbolic constant, record field, function reference, or an
arithmetic expression enclosed in parentheses.
infix-op
is one of:
**
*
/
+
-
If a signed element (prefix-op item) follows an infix operator, you must enclose
the signed element in parentheses as in the following example:
A + (-B)
[ prefix-op ] item [ infix-op item ]...
Table 3-1. Arithmetic Operators
Operator Operation Example Meaning
** Exponentiation A ** B Raise A to the power B
* Multiplication A * B Multiply A and B
/ Division A / B Divide A by B
+ Addition A + B Add A and B
+ Identity + A Positive A
- Subtraction A - B Subtract B from A
- Negation - A Negative A