Publication 1747-RM001G-EN-P - November 2008
Math Instructions 4-33
X to the Power of Y (XPY)
Use the XPY instruction to raise a value (source A) to a power (source B) and
store the result in the destination. If the value in source A is negative, the
exponent (source B) should be a whole number. If it is not a whole number,
the overflow bit is set and the absolute value of the base is used in the
calculation. Use this instruction with SLC 5/03 (OS302), SLC 5/04 (OS401),
and SLC 5/05 processors.
The XPY instruction uses the following algorithm.
XPY = 2 ** (Y * log
2
(X))
If any of the intermediate operations in this algorithm produce an overflow,
the Arithmetic Overflow Status bit (S:0/1) is set.
Updates to Arithmetic Status Bits
The arithmetic status bits are found in Word 0, bits 0 to 3 in the status file.
After an instruction is executed, the arithmetic status bits in the status file are
updated.
XPY
X To Power of Y
Source A N7:53
2<
Source B N7:54
3<
Dest N7:55
0<
XPY
Output Instruction
Fixed SLC
5/01
SLC
5/02
SLC
5/03
SLC
5/04
SLC
5/05
•••
Table 4.25 Processor Function
With this Bit The Processor
S:0/0 Carry (C) always resets.
S:0/1 Overflow (V) sets if an overflow is generated or an unsupported input is
detected; otherwise resets.
S:0/2 Zero (Z) sets if the result is zero; otherwise resets.
S:0/3 Sign (S) sets if the result is negative; otherwise resets.