FORTRAN 77 Language Reference

Arithmetic Assignment

v is of numeric type and is the name of a variable, array element, or record field.

e is an arithmetic expression, a character constant, or a logical expression. Assigning logicals to numerics is nonstandard, and may not be portable; the resultant data type is, of course, the data type of v. @

Execution of an arithmetic assignment statement causes the evaluation of the expression e, and conversion to the type of v (if types differ), and assignment of v with the resulting value typed according to the following table.

Type of v

Type of e

INTEGER*2, INTEGER*4, or INTEGER*8

REAL

REAL*8

REAL*16 (SPARC only)

DOUBLE PRECISION

COMPLEX*8

COMPLEX*16

COMPLEX*32 (SPARC only)

INT(e)

REAL(e)

REAL*8

QREAL(e) (SPARC only)

DBLE(e)

CMPLX(e)

DCMPLX(e)

QCMPLX(e) (SPARC only)


Note -

Compiling with any of the options -i2, -dbl, -r8, or -xtypemap can alter the default data size of variables and expressions. This is discussed in Chapter 2. See also the Fortran User's Guide for a description of these options.


Example: An assignment statement:


       REAL A, B 
       DOUBLE PRECISION V 
       V = A * B 

The above code is compiled exactly as if it were the following:


       REAL A, B 
       DOUBLE PRECISION V 
       V = DBLE( A * B )