7.12 Special Function Instructions
7.12.17 Square root operation on floating-point data (single precision)
7-263
7
APPLI
C
A
T
IO
N
INSTRUCTIONS
SQR
SQR
O
peration Error
In any of the following cases, an operation error occurs, the error flag (SM0) is turned ON, and
the corresponding error code is stored to SD0.
• The value specified for
is a negative number.
(Error code: 4100)
• The value of the specified device is 0.
*1
(Error code: 4100)
*1: There are CPU modules that will not result in an operation error if 0 is specified. For details, refer to
• The value of the specified device is outside the following range. (For Universal model
QCPU only)
0, 2
-126
| value of the specified device | < 2
128
(Error
code:
4140)
• The operation result exceeds the following range. (An overflow occurs.)
(For Universal model QCPU only)
2
128
| operation result |
(Error code: 4141)
• The value of the specified device is 0, unnormalized number, nonnumeric or
±∞
.
(For Universal model QCPU only)
(Error code: 4140)
Program Example
In the following program, the square root function is evaluated on the value set in the BCD 4
digits in the devices from X20 to X2F, and the result is stored to Var_D0 as a floating-point real
number.
[Structured ladder]
[ST]
IF SM400 THEN
BIN(TRUE,K4X20,Var_D20);
FLT(TRUE,Var_D20,Var_D10);
SQRP(TRUE,Var_D10,Var_D0);
END_IF;
[Operation example when the value of 650 is specified for X20 to X2F]
s
I
nputs
the
d
ata
on
wh
i
ch
the
s
q
uare
root
funct
i
on
i
s
eva
l
uate
d. ( )
Sq
uare
root
operat
i
on
( )
Converts
the
i
nput
d
ata
to
32
-
b
i
t
f
l
oat
i
ng
-
po
i
nt
rea
l
number
d
ata
. ( )
1
2
3
X2F
BCD value
0
Var_D20
6 5 0
X20 BIN conversion
BIN
b15
b0
BIN value
650
Floating-point real
number
FLT
SQ
R operation
Var_D10
SQ
R
Var_D0
6 5 0
2 5 . 4 9 5 1
1
2
3
Содержание MELSEC Q Series
Страница 1: ...Structured Programming Manual Mitsubishi Programmable Controller QCPU Common Instructions ...
Страница 2: ......
Страница 14: ...A 12 MEMO ...
Страница 340: ...6 178 MEMO MTR ...
Страница 708: ...7 368 MEMO ...
Страница 776: ...8 68 MEMO ...
Страница 796: ...9 20 MEMO ...
Страница 804: ...App 8 MEMO ...
Страница 812: ...Index 8 MEMO ...
Страница 815: ......