VMS Help
FORTRAN, Statements, Assignment
*Conan The Librarian (sorry for the slow response - running on an old VAX)
|
|
Assigns the value of the expression to the variable.
Arithmetic/Logical/Character assignment takes the form:
v = e
v Is a scalar memory reference.
e Is an arithmetic expression (arithmetic assignment),
a character scalar memory reference (character assignment),
or a logical scalar memory reference (logical assignment).
The right side of the equation must evaluate to a data type
compatible with the variable on the left side. If aggregates are
involved, the aggregate reference and the aggregate must have
matching structures.
The following tables summarize the conversion rules for assignment
statements. MS signifies the most significant (high-order) bit; LS
signifies the least significant (low-order) bit.
----------------------------------------------------------------
|Variable | Expression (E) |
|or Array |-----------------------------------------------------
|Element |integer or logical | REAL | REAL*8 |
----------------------------------------------------------------
| integer | Assign E to V | Truncate E to | Truncate E to |
| or | | integer and | integer and |
| logical | | assign to V | assign to V |
----------------------------------------------------------------
| REAL | Append fraction | Assign E to V | Assign MS por- |
| | (.0) to E and | | tion of E to V;|
| | assign to V | | LS portion of E|
| | | | is rounded |
----------------------------------------------------------------
| REAL*8 | Append fraction | Assign E to MS| Assign E to V |
| | (.0) to E and | portion of V; | |
| | assign to V | LS portion of | |
| | | V is 0 | |
----------------------------------------------------------------
| REAL*16 | same as above | same as above | Assign E to MS |
| | | | portion of V; |
| | | | LS portion of V|
| | | | is 0 |
----------------------------------------------------------------
| COMPLEX | Append fraction | Assign E to | Assign MS por- |
| | (.0) to E and | real part of | tion of E to |
| | assign to real | V; imaginary | real part of V;|
| | part of V; imagin-| part of V is | LS portion of |
| | ary part of V is | 0.0 | E is rounded; |
| | 0.0 | | imaginary part |
| | | | of V is 0.0 |
----------------------------------------------------------------
|COMPLEX*16| Append fraction | Assign E to MS | Assign E to |
| | (.0) to E and | portion of | real part of |
| | assign to V; | real part of V;| V; imaginary |
| | imaginary part of| imaginary part | part is 0.0 |
| | V is 0.0 | of V is 0.0 | |
----------------------------------------------------------------
continued chart
----------------------------------------------------------------
|Variable | Expression (E) |
|or Array |-----------------------------------------------------
|Element | REAL*16 | COMPLEX | COMPLEX*16 |
----------------------------------------------------------------
| integer | Truncate E | Truncate real | Truncate real part of|
| or | to integer | part of E to | E to integer and |
|logical | and assign | integer and | assign to V; imagin- |
| | to V | assign to V; | ary part of E is not |
| | | imaginary part| used |
| | | is not used | |
----------------------------------------------------------------
| REAL | Assign MS | Assign real | Assign MS portion of |
| | portion of E| part of E to | the real part of E to|
| | to V; LS | V; imaginary | V; LS portion of the |
| | portion of E| part of E is | real part of E is |
| | is rounded | not used | rounded; imaginary |
| | | | part of E is not used|
----------------------------------------------------------------
| REAL*8 | same as | Assign real | Assign real part of E|
| | above | part of E to | to V; imaginary part |
| | | MS of V; LS | of E is not used |
| | | portion of V | |
| | | is 0; imagin- | |
| | | ary part of E | |
| | | is not used | |
----------------------------------------------------------------
| REAL*16 | Assign E to | same as above | Assign real part of E|
| | V | | to MS portion of V; |
| | | | LS portion of real |
| | | | part of V is 0; imag-|
| | | | inary part of E is |
| | | | not used |
----------------------------------------------------------------
| COMPLEX | Assign MS | Assign E to V | Assign MS portion of |
| | portion of E| | real part of E to |
| | to real part| | real part of V; LS |
| | of V; LS | | portion of real part |
| | portion of E| | of E is rounded. |
| | is rounded; | | Assign MS portion of |
| | imaginary | | imaginary part of E |
| | part of V is| | to imaginary part of |
| | 0.0 | | V; LS portion of |
| | | | imaginary part of E |
| | | | is rounded |
----------------------------------------------------------------
|COMPLEX*16| same as | Assign real | Assign E to V |
| | above | part of E to | |
| | | MS portion of | |
| | | real part of V;| |
| | | LS portion of | |
| | | real part is 0.| |
| | | Assign imagin- | |
| | | ary part of E | |
| | | to MS portion | |
| | | of imaginary | |
| | | part of V; | |
| | | LS portion of | |
| | | imaginary part | |
| | | is 0 | |
----------------------------------------------------------------
[legal]
[privacy]
[GNU]
[policy]
[netiquette]
[sponsors]
[FAQ]
Polarhome, production since 1999.
Member of Polarhome portal.