FORTRAN77 Arithmetic Expressions

Note:The order of evaluation of an expression is:
  1. sub-expressions in parentheses
  2. function references
  3. exponentiation, i.e. raising to a power
  4. multiplication and division
  5. addition, subtraction, or negation.
Within each of these groups evaluation proceeds from left to right, except that exponentiations are evaluated from right to left. Thus: A / B / C is equivalent to (A / B) / C whereas X ** Y ** Z is equivalent to X ** (Y ** Z).

Note: An expression does not have to be evaluated fully if its value can be determined otherwise: for example the result of:
X * FUNC(G)
can be determined without calling the function FUNC if X happens to be zero. This will not cause problems if you only use functions that have no side effects.(Like short-circute of ||)
A Fortran system is not required to evaluate every term in a logical expression completely if its value can be determined more simply.

评论

此博客中的热门博文

Nu förbjuder Kina handel med elfenben

Fader av pingyins

Kineserna vill köpa Volvos kompetens