Download Print this page

Compare Decimal; Divide Decimal - IBM 4300 Manual

Processors principles of operation for ecps: vse mode
Hide thumbs Also See for 4300:

Advertisement

COMPARE DECIMAL
CP
0,(L"B,),02(L2,B2)
[SS]
/
I
B2
I
/
'F9'
I
L,
I
L2
I
B,
I
0,
~U
/
0
8
'2
'6
20
32
36
47
The first operand is compared with the second
operand, and the result is indicated in the condition
code. The operands are in the packed format.
Comparison is algebraic and follows the
procedure for decimal subtraction, except that both
operands remain unchanged. When the difference
is zero, the operands are equal. When a nonzero
difference is positive or negative, the first operand
is high or low, respectively.
Overflow cannot occur because the difference is
discarded.
All sign and digit codes are checked for validity.
Resulting Condition Code:
o
Operands are equal
1
First operand is low
2
First operand is high
3
Program Exceptions:
Access (fetch, operands 1 and 2)
Data
Programming Notes
1.
An example of the use of COMPARE
DECIMAL is given in Appendix A.
2. The comparison operation does not distinguish
between valid sign codes. A valid plus or
minus sign is equivalent to any other valid plus
or minus sign, respectively.
DIVIDE DECIMAL
Op
0,(L"B,},02(L2,B2}
[SS]
/
/
'FO'
I
L,
I
L2
I
B,
I
0,
I
B2
I
~U
/
0
8
'2
'6
20
32
36
47
The first operand (the dividend) is divided by the
second operand (the divisor). The resulting
quotient and remainder are placed in the
first-operand location. The operands and result are
in the packed format.
The quotient is placed leftmost in the
first-operand location. The number of bytes in the
quotient is equal to the difference between the
dividend and divisor lengths (L
1 -
L
2 ).
The
remainder is placed rightmost in the first-operand
location and has a length equal to the divisor
length. Together, the quotient and remainder
occupy the entire first operand; therefore, the
address of the quotient is the address of the first
operand.
The divisor length cannot exceed 15 digits and
sign (L
2
not greater than seven) and must be less
than the dividend length (L
2
less than L
1 );
otherwise, a specification exception is recognized.
The operation is suppressed, and a program
interruption occurs.
The dividend, divisor, quotient, and remainder
are all signed decimal integers, right-aligned in
their fields. All sign and digit codes of the
dividend and divisor are checked for validity.
The sign of the quotient is determined by the
rules of algebra from the dividend and divisor
signs. The sign of the remainder has the same
value as the dividend sign. These rules hold even
when the quotient or remainder is zero.
Overflow cannot occur. If the divisor is zero or
the quotient is too large to be represented by the
number of digits allowed, a decimal-divide
exception is recognized. The operation is
suppressed, and a program interruption occurs. The
operands remain unchanged in storage. The
decimal-divide exception is indicated only if the
sign codes of both the dividend and divisor are
valid, and only if the digit or digits used in
establishing the exception are valid.
Condition Code: The code remains unchanged.
Program Exceptions:
Access (fetch, operand 2; fetch and store,
operand 1)
Data
Decimal Divide
Specification
Programming Notes
1. An example of the use of DIVIDE DECIMAL
is given in Appendix A.
2. The dividend cannot exceed 31 digits and sign.
Since the remainder cannot be shorter than one
digit and sign, the quotient cannot exceed 29
digits and sign.
3. The condition for a decimal-divide exception
can be determined by a trial subtraction. The
leftmost digit of the divisor is aligned one digit
to the right of the leftmost dividend digit.
Chapter 8. Decimal Instructions
8-5

Advertisement

loading