3. Instructions
450
CS/CJ/NSJ Series Instructions Reference Manual (W474)
ROOT
Applicable Program Areas
Operands
z Operand Specifications
Flags
Function
Instruction Mnemonic Variations
Function
code
Function
BCD SQUARE ROOT ROOT @ROOT 072
Computes the square root of an 8-digit BCD num-
ber and outputs the integer portion of the result to
the specified result word.
Symbol
ROOT
Area
Function block
definitions
Block program areas Step program areas Subroutines Interrupt tasks
SFC action or
transition programs
Usage OK OK OK OK OK OK
Operand Description Data type Size
S First source word DWORD 2
R Result word WORD 1
Area
Word addresses
Indirect DM/EM
addresses
Con-
stants
Registers Flags
Pulse
bits
TR
bits
CIO WR HR AR T C DM EM
@DM
@EM
*DM
*EM
DR IR
Indirect
using IR
TK CF
S
OK OK OK OK OK OK OK OK OK OK
OK ---
--- OK --- --- --- ---
R --- OK
Name Label Operation
Error Flag ER • ON if the data in S+1 and S is not BCD.
• OFF in all other cases.
Equals Flag = • ON if the result is 0000.
• OFF in all other cases.
ROOT(072) computes the square root of the 8-digit
BCD number in S+1 and S and outputs the integer
portion of the result to R.
Note 1 The non-integer remainder is eliminated.
2 The operands of this instruction (S+1, S,
and R) are all treated as BCD values. If the
input data is binary, use the ROTB(620)
instruction.
S: First source word
R: Result word
ROOT(072)
S
R
RS+1 S
Binary data (8 digits) Binary data (4 digits)