next up previous contents
Next: Loops Up: A short summary of Previous: Standard functions   Contents


Assignment

The assignment statement in FORTRAN in FORTRAN has the form:
  variable = expression
If the variable is of type LOGICAL, the the expression has to be a logical expression. If the variable is of type integer then the expression has to be an integer expression or rounding off will take place in case of a real expression. If the variable is of type real then the expression can be of type real or integer.
Division of two integers (also in expressions) is in fact integer division; the result is integer and will not be rounded but truncated.
Examples:
  7/3 gives 2
  3d0*(1/2) gives 0
When raising a number to a power, there is a difference between an integer exponent and a real exponent. When the exponent is integer, repeated multiplication will be used. Instead, if the exponent is real, exponential and logarithmic functions are used for the evaluation. Thus, -2d0**2 is equal to 4, but -2d0 ** 2d0 gives an error message.

Mathieu Pourquie 2001-02-28