IBM 1130 User Manual page 508

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

Advertisement

Integer Mode
An integer is defined as a whole number, a number
with no fractions. Using 1130 FORTRAN, integers
are limited to a magnitude of +32767 to -32768.
This range is due to the fact that an integer must fit
in one 16-bit word. 32767 is the largest positive
number that can fit in one word (0111111111111111,
where the first bit represents the sign); -32768 is
the largest negative number.
Because of these two limitations (magnitude, and
lack of fractions) you must be careful in your use of
integer mode arithmetic. Integer mode is generally
used for counters and indicators. However, if you
desire to keep track of the position of the decimal
point yourself, you can use integer arithmetic to
process data with implied decimal points.
Section
Subsections
Page
70
10
I
10
01
For example, if you lmow that pay rates at your
company range from $1. 25 to $6.50 per hour, you
could represent these rates as integers ranging from
125 to 650 cents per hour. If rates ranged from
$1. 250 to $6.500 per hour, with some rates involv-
'ing fractions of cents (say $3.375 per hour), they
could be represented as integers from 1250 to 6500
mills per hour.
Since mixed mode arithmetic is permitted in 1130
FORTRAN, ,there is no problem involved in multi-
plying the integer IRATE by the real HOURS:
PAY
=
HOURS
*
IRATE
If IRATE is 3125 ($3.125 per hour) and HOURS is
33.5, PAY will be 104687.5. After the multipli-
cation you must be careful to reposition the decimal
point in the proper place ($104.6875) and round off
($104.69) before printing the result or accumulating
totals.

Advertisement

Table of Contents
loading

Table of Contents