インテル® Fortran コンパイラー 19.0 デベロッパー・ガイドおよびリファレンス
For numeric assignment statements, the variable and expression must be numeric type. The expression may also be of logical type.
The expression must yield a value that conforms to the range requirements of the variable. For example, a real expression that produces a value greater than 32767 is invalid if the entity on the left of the equal sign is an INTEGER(2) variable.
Significance can be lost if an INTEGER(4) value, which can exactly represent values of approximately the range -2*10**9 to +2*10**9, is converted to REAL(4) (including the real part of a complex constant), which is accurate to only about seven digits.
If the variable has the same data type as that of the expression on the right, the statement assigns the value directly. If the data types are different, the value of the expression is converted to the data type of the variable before it is assigned.
The following table summarizes the data conversion rules for numeric assignment statements.
Scalar Memory Reference (V) |
Expression (E) |
|
---|---|---|
Integer or Real |
Complex |
|
Integer |
V=INT(E) |
V=INT(REAL(E)) Imaginary part of E is not used. |
REAL (KIND=4) |
V=REAL(E) |
V=REAL(REAL(E)) Imaginary part of E is not used. |
REAL (KIND=8) |
V=DBLE(E) |
V=DBLE(REAL(E)) Imaginary part of E is not used. |
REAL (KIND=16) |
V=QEXT(E) |
V=QEXT(REAL(E)) Imaginary part of E is not used. |
COMPLEX (KIND=4) |
V=CMPLX(REAL(E), 0.0) |
V=CMPLX(REAL(REAL(E)), REAL(AIMAG(E))) |
COMPLEX (KIND=8) |
V=CMPLX(DBLE(E), 0.0) |
V=CMPLX(DBLE(REAL(E)), DBLE(AIMAG(E))) |
COMPLEX (KIND=16) |
V=CMPLX(QEXT(E), 0.0) |
V=CMPLX(QEXT(REAL(E)), QEXT(AIMAG(E))) |
If the expression (E) is of type logical, it is first converted to type integer as follows:
The result of this conversion is then interpreted according to the above table.
BETA = -1./(2.*X)+A*A /(4.*(X*X)) |
|
PI = 3.14159 |
|
SUM = SUM + 1. |
|
ARRAY_A = ARRAY_B + ARRAY_C + SCALAR_I |
! Valid if all arrays conform in shape |
3.14 = A - B |
Entity on the left must be a variable. |
ICOUNT = A//B(3:7) |
Implicitly typed data types do not match. |
SCALAR_I = ARRAY_A(:) |
Shapes do not match. |