DIV

VAX11

 

DIV         DIVIDE

 

Purpose

perform arithmetic division

Format

opcode divr.rx, quo.mx 2 operand

opcode divr.rx, divd.rx, quo.wx            3 operand

Operation

quo ß quo / divr;         2 operand

quo ß divd / divr;        3 operand

Condition codes

N ß quo LSS 0;

Z ß quo EQL 0;

V ß {overflow} OR {divr EQL 0};

C ß 0;

Exceptions

Integer overflow

Divide by zero

Floating overflow

Floating underflow

Reserved operand

Opcodes

86        DIVB2             Divide Byte 2 Operand

87        DIVB3             Divide Byte 3 Operand

A6       DIVW2            Divide Word 2 Operand

A7       DIVW3            Divide Word 3 Operand

C6       DIVL2             Divide Long 2 Operand

07        DIVL3             Divide Long 3 Operand

46        DIVF2             Divide Floating 2 Operand

47        DIVF3             Divide Floating 3 Operand

66        DIVD2             Divide Double 2 Operand

67        DIVD3             Divide Double 3 Operand

Description

In 2 operand format, the quotient operand is divided by the divisor operand and the quotient operand is replaced by the result. In 3 operand format, the dividend operand is divided by the divisor operand and the quotient operand is replaced by the result. In floating format, the quotient operand result is rounded for both 2 and 3 operand format.

Notes

1. Integer division is performed such that the remainder (unless it is zero) has the same sign as the dividend; i.e., the result is truncated towards 0.

2. Integer overflow occurs if and only if the largest negative integer is divided by -1. On overflow, operands are affected as in 3 below.

3. In the integer divisor operand is 0, then in 2 operand integer format, the quotient operand is not affected; in 3 operand format the quotient operand is replaced by the dividend operand.

4. On a floating reserved operand fault, the quotient operand is unaffected and the condition codes are un predictable.

5. On floating underflow, the quotient operand is replaced by 0.

6. On floating divide by zero or on floating overflow the quotient operand is replaced by an operand of all bits 0 except for a sign bit of 1 (a reserved operand).

N ß 1; Z ß 0; V ß 1; and C ß 0.