EasyManuals Logo
Home>IBM>Desktop>1620

IBM 1620 User Manual

IBM 1620
111 pages
To Next Page IconTo Next Page
To Next Page IconTo Next Page
To Previous Page IconTo Previous Page
To Previous Page IconTo Previous Page
Page #21 background imageLoading...
Page #21 background image
FORTRAN
Arithmetic
Functions
If
an
arithmetic
statement
is in mixed mode,
the
mode
of
the
variable on
the
left side of
the
equal
sign determines
the
mode
of
the
result.
If
the
variable on
the
left is in fixed
point
and
the
expression on
the
right
is
in
floating point,
the
expression will first
be
evaluated
in floating point,
the
portion
following
the
decimal
point
will
be
dropped,
and
the
remainder
will
be
converted
to fixed
point
by
retaining only
the
four digits immediately to
the
left of
the
decimal.
If
a result is
123456.78
the
fixed
point
quantity
stored is 3456.
If
the
variable on
the
left is in floating
point
and
the
expression on
the
right
is
in
fixed point,
the
expression will
be
evaluated
in fixed
point
and
the
result con-
verted
to floating point.
For
example,
Arithmetic
Statement
A =
5/3
A =
5./3.
I =
5/3
I =
3./2.
I = 123456.78/4.
Result
A=1.
A = 1.6666666
I = 1
I
= 1
I = 864
(was
computed
as 30864.195)
If
your problems
are
programmed
in
floating point
rather
than
in
fixed point, you
will find
it
is easier to process fractions
because
you will
not
have
the
problem of
locating decimal points.
If
a particular
problem
that
you
are
programming
requires
the
use of fixed
point
quantities, you
must
understand
exactly
how
fixed
point
arithmetic is accomplished.
In
fixed
point
calculations,
if
the
result
is
not
an
integer
(whole
number)
the
result is
truncated
to a whole number.
That
is,
the
fractional portion of
the
result
is discarded,
and
no
rounding
takes place.
The
fixed
point
division
5/3
is
1,
not
2.
Therefore,
if
you
write
an
expression
with
a series of operations
that
includes a division, you
must
be
careful
when
grouping.
For
example,
A =
5./3.
~<
4.
In
floating point, 5 divided by
.3
equals 1.6666666,
and
this value multiplied
by
4 equals 6.6666664.
If
this arithmetic
statement
is written
in
fixed point,
I =
5/3
* 4
then
5 divided
by
.3
equals 1.6, which is
truncated
to
1.
The
1 is multiplied
by
4
and
the
answer is
4.
If
you
had
reversed
the
grouping in
the
statement,
I = 4
*5/3
the
result
would
be
6.
Remember, in a
statement
with
a series of multiplications
and
divisions
where
the
parentheses have
been
omitted
the
operations
are
per-
formed from
left
to right.
Assume
that
you
are
writing a
FORTRAN
program
that
requires taking
the
square
root of a
number
at
different locations
in
the
program.
The
statements to perform
the
sql1are
root
would
be
identical, except for
the
different arguments
used
each
time.
Writing the 1620
FORTRAN
Program
21

Other manuals for IBM 1620

Questions and Answers:

Question and Answer IconNeed help?

Do you have a question about the IBM 1620 and is the answer not in the manual?

IBM 1620 Specifications

General IconGeneral
BrandIBM
Model1620
CategoryDesktop
LanguageEnglish

Related product manuals