146
4
4 Instructions4.4.5 Exponent Operations
◆
Function
The square root of a binary oating-point number is calculated.
If the constant K or H is used as the operand S, the value is converted to a oating-point number before
square root calculation.
The zero ag M8020 is set if the result of the calculation is 0.
The value in S must be positive. If it is negative, a calculation error will occur, and M8067 and M8068 are
set to ON to identify this error.
Example:
ǒDESQR D200 D10Ǔ
X16 S
The square root of the binary floating-point number in (D201, D200)
is calculated . The result is stored in (D11, D10).
The square root of a floating-point number converted from K6789 is
calculated. The result is stored in (D21, D20).
The constant K6789 is converted to a binary floating-point number
before operation.
ǒDESQR K6789 D20Ǔ
(D201,D200)
SQR: Binary number square root operation
◆
Overview
The SQR instruction calculates the square root of a binary number.
SQR S D
Binary number
square root
operation
Applicable model:
H3U
S
Data
source
Data whose square root is to be calculated, or address of
the word element that stores the data
16-bit instruction
(5 steps)
SQR: Continuous
execution
SQRP: Pulse
execution
32-bit instruction
(9 steps)
DSQR:
Continuous
execution
DSQRP: Pulse
execution
D
Operation
result
Address of the word element that stores the calculated
square root
◆
Operands
Operand
Bit Element Word Element
System·User System·User Bit Designation Indexed Address Constant
Real
Number
S X Y M T C S SM D R T C SD KnX KnY KnM KnS KnSM
V,Z
Modication K H E
D X Y M T C S SM D R T C SD KnX KnY KnM KnS KnSM
V,Z
Modication K H E
Note: The elements in gray background are supported.
◆
Function
The square root of the BIN value in S is calculated. The result is stored in D.
The value in S must be positive. If it is negative, an operation error will occur, and the error ag M8067 is
set to ON to identify this error and the instruction is not executed.
The operation result D must be an integer. The borrow ag M8021 is set to ON when the fractional part (if
any) of the operation result is discarded.
The zero ag M8020 is set to ON when the operation result is 0.