1 square root instruction (sqrt) – Yaskawa Ladder Works Programming Manual User Manual

Page 84

Advertising
background image

5.1 SQUARE ROOT Instruction (SQRT)

5-2

5.1 SQUARE ROOT Instruction (SQRT)

[Outline]

The SQRT instruction calculates the square root of an integer or real number value as the operation
result. The input units and output results for integer and real number values are different. This
instruction cannot be used for double-length integer data.

Integer Type Data
The square root of Source is stored in Dest. The operation result of the SQRT instruction slightly
differs from the square root in mathematical terms. To be more precise, the operation result is
expressed by the following formula:

32768* sign (A)*SQRT (|A|/ 32768)

sign (A):sign of the Source

|A| :absolute value of the Source

In other words, the operation result is equal to the mathematical square root multiplied by
approximately 181.02. If the input is a negative value, the square root of the absolute value is
calculated first and then the negative value of the square root is output as the operation result.

The maximum error of the output value is +/-2.

Real Number Type Data
The square root of Source is stored in Dest. If the input is a negative value, the square root of the
absolute value is calculated first and then the negative value of the square root is output as the
operation result. This instruction can be used in a real number operation.

[Format]

Symbol : SQRT
Full Name : Square Root
Category : FUNCTION

Icon :

[Parameter]

Parameter Name

Setting

Source
(Input)

· Any integer type and real number type register
· Any integer type and real number type register with subscript
· Subscript register
· Constant

Dest
(Output)

· Any integer type and real number type register (except for # and C

registers)

· Any integer type and real number type register with subscript (except for #

and C registers)

· Subscript register

Advertising