Advanced Function Instruction
7-5
FUN 26 D P
SQRT
SQUARE ROOT
FUN 26 D P
SQRT
S : Source register to be taken square root
D : Register for storing result
(square root value)
S, D may combine with V, Z, P0~P9 to serve
indirect address application
WX WY WM WS TMR CTR HR IR OR SR ROR DR K XR
Range
Ope-
rand
WX0
∣
WX240
WY0
∣
WY240
WM0
∣
WM1896
WS0
∣
WS984
T0
∣
T255
C0
∣
C255
R0
∣
R3839
R3840
∣
R3903
R3904
∣
R3967
R3968
∣
R4167
R5000
∣
R8071
D0
∣
D4095
16/32-bit
V、Z
P0~P9
S ○ ○ ○ ○ ○ ○ ○ ○ ○ ○ ○ ○ ○ ○
D ○ ○ ○ ○ ○ ○ ○ ○* ○* ○ ○
z When operation control "EN" = 1 or "EN↑" ( P instruction) from 0 to 1, take the square root (rounding off
numbers after the decimal point) of the data specified by the S field, and store the result into the register
specified by D.
z While the S value is derived from the content of the register, if the value is negative, then the S value error
flag "ERR" will be set to 1, and do not execute the operation.
S :
2147483647
D :
26DP.SQRT
ERR
X0
EN
R 0
z The instruction at left calculates the square root of the
constant 2147483647, and stores the result in R0.
S
K 2147483647
Ø
X0=
D R1 R0 46340
R1 R0
9546340.2147483647 =
↑
rounding off