IBM 1130 User Manual page 513

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

Advertisement

Section
Subsections
Page
70
10
I
30
01
Decimal Mode
Introduction
In addition to integer and real mode arithmetic,
there is a third alternative: decimal arithmetic.
This capability is furnished by a group of subrou-
tines supplied with the Commercial Subroutine
Package (1130-SE-25X). This mode of arithmetic
permits variable precision.
Using the decimal arithmetic system, you select
the number of digits to be used for each variable.
If
a grand total can attain a magnitude of 15, 000,
000,000.00, you can allocate 13 digits for it; if the
number of employee dependents never exceeds 99,
you may allocate only two digits for that value.
You are not limited by magnitudes of 32767,
2,147,483, 647., etc. You decide how large a
number can become and set aside enough digits
for its storage.
General Principles
This arithmetic system operates on digits stored
as integers, one digit per word. For example, the
value 1968 would be stored in a four-position array
NYEAR as
NYEAR (1)
1
NYEAR (2)
9
NYEAR (3)
6
NYEAR (4)
8
or in a six-position array as
NYEAR (1)
0
NYEAR (2)
0
NYEAR (3)
1
NYEAR (4)
9
NYEAR (5)
6
NYEAR (6)
8
or in any size array you desire.
Negative values carry the minus sign with the
low-order (or rightmost) digit. However, since
the 1130 cannot represent -0, a special method has
been devised to show negative numbers.
If
the
number is negative, the low-order digit is carried as
one less than its true value.
For example, -1968 is actually held in core
storage as
NYEAR (1)
1
NYEAR (2)
9
NYEAR (3)
6
NYEAR (4) =-9
For ease of reference, we will refer to this as
1968, where the minus sign is written over the
low-order digit.
You need not worry about this unless you are de-
fining negative constants, which should be unusual.
If a negative number is read from a card, this con-
version will be done for you, with the AIDEC
subroutine.
The magnitude of each value will be shown by the
number of digits: 001968 implies a six-digit or
six-word value, 0000001968 implies a ten-word
value.
Each decimal arithmetic value requires three
identifying parameteTs:
The NAME of the array in which it is stored.
KSTRT, the position (or subscript) of the
high-order (leftmost) digit
in
the array.
KLAST, the position of the low-order digit in
the array
When referring to decimal arithmetic values, a
shorthand abbreviation will be used, enclosing these
three parameters in parentheses:
(NAME,KSTRT, KLAST)
For example, if you had a 20-word array called
NUMBR:
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20
000136430 0 7 7
B 3 0 0
081 3
then
(NUMBR, 1, 6)
000136
or
-136
(NUMBR, 1,5)
00013
or
13
(NUMBR, 7,19)
4300778300081
(NUMBR, 15,20) =
00081a
or
-813

Advertisement

Table of Contents
loading

Table of Contents