Dismiss
Surety is performing system maintenance this weekend. Electronic date stamps on new Prior Art Database disclosures may be delayed.
Browse Prior Art Database

# Algorithm for 31-Digit Software Packed Decimal Divide

IP.com Disclosure Number: IPCOM000104541D
Original Publication Date: 1993-May-01
Included in the Prior Art Database: 2005-Mar-19
Document File: 2 page(s) / 54K

IBM

## Related People

Henshaw, J: AUTHOR

## Abstract

Disclosed is an algorithm for dividing numbers maintained in packed decimal format. The size of the divisor and dividend can range from 1 to 31 digits.

This text was extracted from an ASCII text file.
This is the abbreviated version, containing approximately 54% of the total text.

Algorithm for 31-Digit Software Packed Decimal Divide

Disclosed is an algorithm for dividing numbers maintained in
packed decimal format.  The size of the divisor and dividend can
range from 1 to 31 digits.

The algorithm is applicable to all programs that wish to divide
"large" packed decimal values.  The standard System/370- hardware
instruction to divide packed decimal format numbers does not permit
the division of an N-digit dividend by a M-digit divisor where M + N
is greater than 31, or in any case where the M-digit divisor is
greater than 15 digits; the disclosed algorithm permits values of M
and N to be in the range of 1 to 31.

The disclosed algorithm builds a table of values that are used
to subtract from the dividend and generate the appropriate values to
insert in the result.  The result is prepared, one digit per cycle
through the algorithm's loop, until enough digits are created in the
result.

The steps in the algorithm are as follows:

1.  ALIGN DIVISOR AND DIVIDEND.  The dividend and divisor are aligned
such that the value of the dividend is greater than the divisor,
but less than 10 times the divisor.  Based on the alignment,
decide how many digits are to be in the result.

2.  SET RESULT TO ZERO.  The value used to hold the quotient is set
to zero.

3.  BUILD COMPARISON TABLE.  The comparison table holds the multiples
of the divisor, from 1 times the value to the divisor, to...