HPPACLONGDIVD/HPPACDIVD [ Compiler Library/XL Reference Manual ] MPE/iX 5.0 Documentation
Compiler Library/XL Reference Manual
HPPACLONGDIVD/HPPACDIVD
HPPACLONGDIVD/HPPACDIVD calculates the quotient, or the quotient and
remainder, of a decimal dividend and a decimal divisor. These procedures
are provided for compatibility with the MPE V E Compiler Library
procedures, LONGDIVD and DIVD.
Declaration
PROCEDURE HPPACLONGDIVD (
ANYVAR operand2 :decimal_type;
op2digs :INTEGER;
ANYVAR operand1 :decimal_type;
op1digs :INTEGER;
VAR comparison_code :INTEGER;
VAR pacstatus :INTEGER)
OPTION
DEFAULT_PARMS (
comparison_code :=NIL,
pacstatus :=NIL)
UNCHECKABLE_ANYVAR;
EXTERNAL;
or
PROCEDURE HPPACDIVD (
ANYVAR operand2 :decimal_type;
op2digs :INTEGER;
ANYVAR operand1 :decimal_type;
op1digs :INTEGER;
VAR comparison_code :INTEGER;
VAR pacstatus :INTEGER)
OPTION
DEFAULT_PARMS (
comparison_code :=NIL,
pacstatus :=NIL)
UNCHECKABLE_ANYVAR;
EXTERNAL;
Comments
* Operand2 is divided by operand1 and the result is stored into
operand2.
* The operands are converted to binary integers, then divided. Next,
the quotient is (or the quotient and remainder are) converted back to
a packed decimal number(s). If the signs of the operands do not
match and the quotient (or the quotient and the remainder) is not
zero, the sign of the result is set to minus (-).
* When op2digs is a positive integer, the result includes only the
quotient and the sign. The result overlays operand2, the dividend.
* When op2digs is a negative integer, the result includes the quotient
value and sign and the remainder value and sign. The quotient and
sign overlay operand2, the dividend. The remainder and sign are
appended to the original array operand2, in op1digs more bytes
(higher addresses). Therefore, a program to calculate a quotient and
remainder must allocate space beyond the least significant digit of
operand2.
* For HPPACLONGDIVD, the dividend may be up to 36 digits in length.
For HPPACDIVD, the dividend is limited to 28 digits.
MPE/iX 5.0 Documentation