Divide (DIV)


Op Code (Hex) Extender Operand 1 Operand 2 Operand 3 Operand [4-7]
DIV 104F
Quotient Dividend Divisor


DIVR 124F
Quotient Dividend Divisor


DIVI 184F Indicator options Quotient Dividend Divisor Indicator targets


DIVIR 1A4F Indicator options Quotient Dividend Divisor Indicator targets


DIVB 1C4F Branch options Quotient Dividend Divisor Branch targets


DIVBR 1E4F Branch options Quotient Dividend Divisor Branch targets

Operand 1: Numeric variable scalar.

Operand 2: Numeric scalar.

Operand 3: Numeric scalar.

Operand 4-7:

Short forms


Op Code (Hex) Extender Operand 1 Operand 2 Operand [3-6]
DIVS 114F
Quotient/Dividend Divisor


DIVSR 134F
Quotient/Dividend Divisor


DIVIS 194F Indicator options Quotient/Dividend Divisor Indicator targets


DIVISR 1B4F Indicator options Quotient/Dividend Divisor Indicator targets


DIVBS 1D4F Branch options Quotient/Dividend Divisor Branch targets


DIVBSR 1F4F Branch options Quotient/Dividend Divisor Branch targets

Operand 1: Numeric variable scalar.

Operand 2: Numeric scalar.

Operand 3-6:

Description  The quotient is the result of dividing the dividend by the divisor.

Operands can have floating-point, packed or zoned decimal, signed or unsigned binary type.

Source operands are the dividend and divisor. The receiver operand is the quotient.

If operands are not of the same type, source operands are converted according to the following rules:

  1. If any one of the operands has floating point type, source operands are converted to floating point type.

  2. Otherwise, if any one of the operands has zoned or packed decimal type, source operands are converted to packed decimal.

  3. Otherwise, the binary operands are converted to a like type. Note: unsigned binary(2) scalars are logically treated as signed binary(4) scalars.

Source operands are divided according to their type. Floating point operands are divided using floating point division. Packed decimal operands are divided using packed decimal division. Unsigned binary division is used with unsigned source operands. Signed binary operands are divided using two's complement binary division.

Better performance can be obtained if all operands have the same type. Signed and unsigned binary division execute faster than either packed decimal or floating point division.

All of the operands must be numeric with any implicit conversions occurring according to the rules of arithmetic operations as outlined in Arithmetic Operations.

Decimal operands used in floating-point operations cannot contain more than 15 total digit positions.

If the divisor has a numeric value of zero, a zero divide  (hex 0C0B) exception or floating-point zero divide  (hex 0C0E) exception is signaled respectively for fixed-point versus floating-point operations. If the dividend has a value of zero, the result of the division is a zero quotient value.

For a decimal operation, the precision of the result of the divide operation is determined by the number of fractional digit positions specified for the quotient. In other words, the divide operation will be performed so as to calculate a resultant quotient of the same precision as that specified for the quotient operand. If necessary, internal alignment of the assumed decimal point for the dividend and divisor operands is performed to ensure the correct precision for the resultant quotient value. These internal alignments are not subject to detection of the decimal point alignment exception. An internal quotient value will be calculated for any combination of decimal attributes which may be specified for the instruction's operands. However, the assignment of the result to the quotient operand is subject to detection of the size  (hex 0C0A) exception thereby limiting the assignment to, at most, the rightmost 31 digits of the calculated result.

Floating-point division uses exponent subtraction and significand division.

If the dividend operand is shorter than the divisor operand, it is logically adjusted to the length of the divisor operand.

For fixed-point computations and for the significand division of a floating-point computation, the division operation is performed according to the rules of algebra. Unsigned binary is treated as a positive number for the algebra.

For a floating-point computation, the operation is performed as if to infinite precision.

The result of the operation is copied into the quotient operand. If this operand is not the same type as that used in performing the operation, the resultant value is converted to its type. If necessary, the resultant value is adjusted to the length of the quotient operand, aligned at the assumed decimal point of the quotient operand, or both before being copied to it. Length adjustment and decimal point alignment are performed according to the rules for arithmetic operations as outlined in Arithmetic Operations. If significant digits are truncated on the left end of the resultant value, a size  (hex 0C0A) exception is signaled.

If a decimal to binary conversion causes a size  (hex 0C0A) exception to be signaled, the binary value contains the correct truncated result only if the decimal value contains 15 or fewer significant nonfractional digits.

For the optional round form of the instruction, specification of a floating-point receiver operand is invalid.

For fixed-point operations in programs that request to be notified of size  (hex 0C0A) exceptions, if nonzero digits are truncated from the left end of the resultant value, a size  (hex 0C0A) exception is signaled.

For floating-point operations that involve a fixed-point receiver field, if nonzero digits would be truncated from the left end of the resultant value, an invalid floating-point conversion  (hex 0C0C) exception is signaled.

For a floating-point quotient operand, if the exponent of the resultant value is either too large or too small to be represented in the quotient field, the floating-point overflow  (hex 0C06) exception and floating-point underflow  (hex 0C07) exception are signaled, respectively.

Resultant Conditions 

Authorization Required

Lock Enforcement

Exceptions

06 Addressing

08 Argument/Parameter

0C Computation

10 Damage Encountered

1C Machine-Dependent

20 Machine Support

22 Object Access

24 Pointer Specification

2C Program Execution

2E Resource Control Limit

36 Space Management

44 Protection Violation