Справочник Пользователя для Mitsubishi Electronics MELSEC -Q/L
7 APPLICATION INSTRUCTIONS
7.12 Special Function Instructions
631
7
Square root operation for floating-point data (single precision)
SQR(P)
*1 Applicable for the Universal model QCPU, LCPU.
Processing details
• Returns the square root of the value designated at (S), and stores the operation result in the device number designated at
(D).
• Only positive values can be specified by (S). (Operation cannot be performed on negative numbers.)
• When an input value is set using a programming tool, a rounding error may occur. For precautions, refer to Page 90
• When an input value is set using a programming tool, a rounding error may occur. For precautions, refer to Page 90
Operation error
• In any of the following cases, an operation error occurs, the error flag (SM0) turns ON, and an error code is stored into SD0.
*2 There are CPU modules that will not result in an operation error if -0 is specified. For details, refer to Page 88 Using single/double-
• Basic model QCPU: The serial number (first five digits) is "04122" or later.
(S): Data of which the square root is obtained or head number of the devices where the data is stored (real number)
(D): Head number of the devices where the operation result will be stored (real number)
(D): Head number of the devices where the operation result will be stored (real number)
Setting
data
data
Internal device
R, ZR
J\
U\G
Zn
Constant
E
E
Others
Bit
Word
Bit
Word
(S)
(D)
Error
code
code
Error details
Q00J/
Q00/
Q01
Q00/
Q01
QnH
QnPH
QnPRH QnU
LCPU
4100
The value specified in (S) is negative.
The specified device value is -0.
4140
The specified device value is not within the following range:
0, 2
0, 2
-126
| Specified device value | <2
128
The specified device value is -0, unnormalized number, nonnumeric, and
.
4141
The operation result exceeds the following range.
(when an overflow occurs)
2
(when an overflow occurs)
2
128
| Operation result |
Basic
Process
High
performance
Redundant Universal
LCPU
Ver.
Command
Command
SQRP
SQR
SQRP
SQR
S
D
S
D
+
1
+
1
S
D
S
D
(
)
32-bit floating-point
real number
32-bit floating-point
real number