IBM 1130 User Manual page 570

Computing system
Hide thumbs Also See for 1130:
Table of Contents

Advertisement

Reducing Subroutine Requirements
Raising a Real Number to a Whole Power
FORTRAN allows you two ways to do this.
For
example, to square X, a real number, either X**2
or X**2. may be used. While the two look almost
identical, the first will use the "real base to integer
exponent" routines (about 82 words) and the second
will use the "real base to a real exponent" routines
(about 242 words).
In
this case you should code X**2 and save about
160 words of core storage, unless, of course, your
program really requires a real·base to a real
exponent somewhere else.
A programmer will often use this form of arith-
metic to obtain the various powers of ten -- for
example:
10**N
10**0
=
1
10**1
=
10
10**2
=
100
However, if this is the only way in which the
double asterisk is used in a particular program, it
will usually
be
more economical to code:
DATA TEN/I. ,10. ,100. ,1000. ,etc. /
and then use subscripting
'" TEN (N+1) .....
This will eliminate the 82-word subroutine.
Section
Subsections
Page
70
50
I
20
01
SQRT vs **.5
To take the square root of a number, you have two
alternatives: the SQRT function or the 1/2 power
option (**.5). While both will give the same result,
the core storage required is quite different. The
SQRT routine is about 76 words in length; the "real
base to real exponent" routine, about 242 words.
The difference, about 166 words, is substantial.
Of course,
if
your program must use the "real
base to real exponent" routine (for example
~**A),
you need those routines anyway. If that is so, use
the **.5 option rather than SQRT; otherwise, you
will have both packages in core storage.

Advertisement

Table of Contents
loading

Table of Contents