3. Instruction Set
3-311
API Mnemonic Operands Function
127
D ESQR P Floating point square root
Controllers
ES2/EX2 SS2 SA2
SE SX2
Bit Devices Word devices Program Steps Type
OP X Y M S K H KnX KnY KnM KnS T C D E F
S * * *
D *
DESQR, DESQRP: 9
steps
PULSE 16-bit 32-bit
ES2/EX2 SS2 SA2
SE SX2 ES2/EX2 SS2 SA2
SE SX2 ES2/EX2 SS2 SA2
SE SX2
Operands:
S: Source device D: Operation result
Explanations:
1. This instruction performs a square root operation on the floating point value in S and stores the
result in D. All data will be operated in binary floating point format and the result will also be
stored in floating point format.
2. If the source device S is specified as constant K or H, the integer value will automatically be
converted to binary floating value.
3. If operation result of D is 0 (zero), Zero flag M1020 = ON.
4. S can only be a positive value. Performing any square root operation on a negative value will
result in an “operation error” and instruction will not be executed. M1067 and M1068 = ON and
error code “0E1B” will be recorded in D1067.
5. Flags: M1020 (Zero flag), M1067 (Program execution error), M1068 (Execution Error Locked)
Program Example 1:
When X0 = ON, the square root of binary floating point (D1, D0) is stored in (D11, D10) after the
operation of square root.
D0DESQR
X0 D10
(D1, D0) (D11 D10)
,
Binary floating point Binary floating point
Program Example 2:
When X2 = ON, the square root of K1234 (automatically converted to binary floating value) is stored
in (D11, D10).
K1234DESQR
X2 D10