Topic: DMD0115 SQRT - Square Root |
|
This instruction can only be used in the Expression parameter of the Calculate Expression (MATH) instruction.
The Square Root (SQRT) function will compute the square root of the function expression. To perform other "root" calculations see the Raise to Power operator (**), for example, R1 ** ( 1.0 / 3.0 ) will calculate the cube root of R1.
Note: Use the F9 key or click the 'three dot box' at the right edge of the parameter field to open the Default Element Selection Tool (the Element Picker or the Element Browser) or use the Down-Arrow key (Auto-Complete) on any parameter field to see a complete list of the memory locations that are valid for that parameter of the instruction.
Result specifies a numeric memory location to store the result of the calculation. The result is always a real value even if the input parameter is an integer so this should be a writable Real memory location.
The Expression parameter consists of all the text between the bounding parentheses. Any expression parameter can be a constant value, a bit or numeric memory location, an arithmetic expression, and / or mathematical function or other expressions up to a maximum of 1024 characters. Expressions can be nested, so use of parentheses is recommended to ensure proper evaluation order.
The range of acceptable values is 0 or any positive integer or real number, a negative value will generate an 'Argument Out of Range' warning - $OutOfRange (ST132) will be ON.
Some examples:
SQRT( 2 ) = 1.41421
SQRT( 9 ) = 3.0
SQRT( 100.0 ) = 10.0
|
|
See Also:
SQRT - Square Root
|
|
Related Topics:
ROUND - Round Real to Nearest Whole Number
TRUNC - Truncate Real to Whole Number
|
|
Rung Example:
|
|