Mitsubishi QD51 Programming Manual page 552

Logic controller
Hide thumbs Also See for QD51:
Table of Contents

Advertisement

11 INSTRUCTIONS AND FUNCTIONS
SQR
Function
• Returns the square root of the specified value.
SQR(<numeric expression>)
Syntax
numeric expression
A=SQR(50)
Examples
• The SQR function returns the square root of the specified value.
Description
• The value of <numeric expression> must be 0 or positive.
• The calculation of the SQR function is performed in single-precision.
Program Example
10 ' This program returns square root values
20 DIM A(10)
30 PRINT "A(I)=","SQR(A(I))="
40 FOR I=1 TO 10
50 A(I)=SQR(I)
60 PRINT I,
70 PRINT A(I)
80 NEXT I
RUN
A(I)=
SQR(A(I))=
1
1
2
1.41421
3
1.73205
4
2
5
2.23607
6
2.44949
7
2.64575
8
2.82843
9
3
10
3.16228
OK
11 - 382
SQuare Root
• • • •
Specify the value for which the square root should be
obtained.
• • • •
Assigns
50 (= 7.071067...) to A.
:
' Defines an array
:
' Obtains the square root and displays it
MELSEC-Q
11 - 382

Advertisement

Table of Contents
loading

This manual is also suitable for:

Ad51h-s3Qd51-r24A1sd51s

Table of Contents