Intel fortran-80 Laptop User Manual


 
Defining Variables,
Arrays,
And
Memory
3-8
3.3.1
Arithmetic Assignment Statement
The
arithmetic assignment
statement
closely resembles a conventional arithmetic
formula.
Its
format
is:
v =
exp
where
v
is
the
name
of
a variable
or
array
element
of
type integer
or
real
I
exp
is
an
arithmetic expression
The'
='
in
FORTRAN
has the sense 'is assigned the value'
rather
than
'is equal
to.'
Thus
I =
1+1
is
a perfectly correct
FORTRAN
statement.
Execution
of
an
arithmetic assignment
statement
causes evaluation
of
the expression
'exp'
according
to
the rules listed in
Chapter
2 (see Figures 2-2
and
2-3), conversion
of
'exp'
to the type
of
'v,'
and
definition
and
assignment
of
'v'
with the resulting
value, as shown in Figure 3-2.
IFIX
and
FLOAT
in this figure are intrinsic functons
for converting a real
number
to
an
integer
and
an
integer
to
a real
number,
respec-
tively.
TYPE
OF
'v'
TYPE
OF
'exp'
INTEGER
REAL
INTEGER
REAL
Example:
INTEGER
REAL
REAL
INTEGER
f'i~.
3-2 Result
of
'v
= exp'
1=3
C = I + SQRT(25.0)
C =
C**2
RESULT
exp
exp
IFIX (exp)
FLOAT
(exp)
C
AS A RESULT OF THESE
CALCULATIONS
C = 64.0
If
the value
of
'exp'
is
too
large to be assigned
to
'v'
the result
is
undefined. This
may
happen
when the length
of
'v'
is
too
short
to
contain the processor representa-
tion
of
the integer value (see section
F.l).
If
the length
of
'v'
is
longer, the length
of
'exp'
is
converted to the length
of
'v'
while
preserving its value.
Example:
INTEGER* 1 M(1000)
INTEGER*4
N
N
= 65
M(200) = N
C LENGTH
OF
IN'
IS CONVERTED TO
ONE
BYTE
FORTRAN-80