M800V/M80V Series PLC Programming Manual (1/2)
8 Function Instructions
8.11 Special Function Instructions
SQR, SQRP: Square root operation on floating-point data (single precision)
Setting
Bit devices
data
X
Y
M
L
F
S
D
△ : This is not available with ST.
[Instruction symbol] [Execution condition]
SQR
SQRP
Setting data
Setting data
Data for which the square root is obtained or the first number of the device where
S
data is stored.
D
The first number of the device to store the operation result.
Functions
SQR
Returns the square root of the value designated by (S) and stores the operation result in the device number designated by
(D).
S
+
1
S
(
32-bit floating-point real
number
Only positive values can be designated by (S). (Operation cannot be performed with negative numbers.)
When setting input values from programming tools, rounding errors may occur.
For precautions when setting input values from programming tools, refer to "6.3.4 Single/Double-Precision Real Number
Data".
Operation errors
In the following cases, an arithmetic error occurs, the error flag (SM0) turns ON, and an error code is stored at SD0.
- The value designated by (S) is a negative number. (Error code: 34)
- The designated device value is not within the following range. (Error code: 35)
-126
0, 2
≤ | Designated device value | < 2
- The designated device value is "-0", unnormalized number, nonnumeric, or ± ∞ . (Error code: 35)
- The operation result exceeds the following range. (When an overflow occurs) (Error code: 36)
| Operation result | < 2
IB-1501667-B
Usable devices
B SB
T SM V
T
C
○
○
○
○
Command
Command
Meaning
D+1
)
32-bit floating-point real
number
128
128
Con-
Word devices
stant
D
R/ZR W SW SD
Z
○
○
○
○
○
△
○
○
○
○
○
△
D
392
Digit
Pointer
designa-
Index
tion
E
P
○
○
indicates the sign "SQR".
S
D
P
S
D
Data type
Real number