POLY

VAX11

 

POLY      POLYNOMINAL EVALUATION

 

Purpose

allows fast calculation of math functions

Format

opcode arg.rx, degree.rw, tbladdr.ab

Operation

result C  ß degree;

For degree times, loop

    result ß arg * result;

            Perform multiply, and retain an extended floating traction                       of 31 bits (POLYF) or 63 bits (POLYD)

            (the fraction is truncated before normalization)

            use this result in the following step

    result ß result + next coefficient;

            normalize, round, and check for over/underflow only after                      the combined multiply/add sequence

  if overflow then trap;

  if underflow then clear result, remember underflow and continue looping;

Condition codes

N ß R0 LSS 0;

Z ß R0 EQL 0;

V ß {floating overflow};

C  ß 0;

Exceptions

Floating overflow

Floating underflow

Reserved operand

Opcodes

55        POLYF            Polynomial Evaluation Floating

75        POLYD           Polynomial Evaluation Double

Description

The table address operand points to a table of polynomial coefficients. The coefficient of the highest order term of the polynomial is pointed to by the table address operand. The table is specified with lower order coefficients stored at in creasing addresses. The data type of the coefficients is the same as the data type of the argument operand.

The evaluation is carried out by Homer's method and the contents of R0 (R1’R0 for POLYD) are replaced by the result. The result computed is:

            if d = degree and x = arg

                        result = C[0] + x*(C[1] + x*(C[2] +...x*C[d])))

The unsigned word degree operand specifies the highest numbered coefficient to participate in the evaluation.

Notes

1. After execution:

POLYF

R0 = result

R1 = 0

R2 = 0

R3 = table address + degree*4 + 4

POLYD

R0 = high order part of result

R1 = low order part of result

R2 = 0

R3 = table address + degree *8 + 8

R4 = 0

R5 = 0

2. The multiplication is performed such that the precision of the product is equivalent to a floating point datum having a 31-bit (63-bit for POLYD) fraction.

3. If the unsigned word degree operand is 0, the result is C0.

4. If the unsigned word degree operand is greater than 31, a reserved operand exception occurs.

5. On a reserved operand exception:

• If PSL<FPD> = 0, the reserved operand is either the degree operand (greater than 31), or the argument operand, or some coefficient.

• If PSL<FPD> = 1, the reserved operand is a coefficient, and R3 is pointing at the value which caused the exception.

• The state of the saved condition codes and the other registers is unpredictable. If the reserved operand is changed and the contents of the condition codes and all registers are preserved, the fault is continuable.

6. On floating underflow after the rounding operation, the temporary result is replaced by zero, and the operation continues. A floating underflow trap occurs at the end of the instruction it underflow occurred during any iteration of the computation loop. Note that the final result may be non zero if underflow occurred before the last iteration.

7. On floating overflow after the rounding operation at any iteration of the computation loop, the instruction terminates and causes a trap. On overflow the contents of R2 and R3 (R2 through R5 for POLYD) are unpredictable. R0 contains the reserved operand (minus 0) and R1 = 0.

8. POLY can have both overflow and underflow in the same instruction. If both occur, overflow trap is taken; underflow is lost.

9. If the argument is zero and one of the coefficients in the table is the reserved operand, whether a reserved operand fault occurs is unpredictable.