Abs (Returns The Absolute Value ) - Mitsubishi QD51 Programming Manual

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

Advertisement

11 INSTRUCTIONS AND FUNCTIONS
ABS
Function
11
• Returns the absolute value of an arithmetic expression.
ABS ( <arithmetic expression> )
Syntax
arithmetic expression
A=ABS( 3.14)
Examples
B=ABS(0)
C=ABS(3.14)
• The ABS function returns the absolute value of <arithmetic expression>.
Description
• Returned values are always positive or 0.
• Returns a double precision number if a double precision real number is included in the
Program Example
10 ' Calculates absolute value
20 A=-2.56
30 B=0
40 C=2.56
50 PRINT "ABS(A)=";ABS(A)
60 PRINT "ABS(B)=";ABS(B)
70 PRINT "ABS(C)=";ABS(C)
80 END
RUN
ABS(A)= 2.56
ABS(B)= 0
ABS(C)= 2.56
OK
11 - 2
ABSolute
<arithmetic expression>, otherwise returns a single precision number.
• • • •
Specify the value to calculate the absolute value.
• • • •
Assigns 3.14 (absolute value of
• • • •
Assigns 0 (absolute value of 0) to B.
• • • •
Assigns 3.14 (absolute value of 3.14) to C.
:
'Defines the value
:
'Displays the absolute value
MELSEC-Q
3.14) to A.
11 - 2

Advertisement

Table of Contents
loading

This manual is also suitable for:

Ad51h-s3Qd51-r24A1sd51s

Table of Contents