Mitsubishi QD51 Programming Manual page 239

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

Advertisement

11 INSTRUCTIONS AND FUNCTIONS
FIX
Function
• Returns only the integer part after truncating the fractional part of the numeric value.
FIX ( <numeric expression> )
Syntax
numeric expression
FIX(1.28) 1
Examples
FIX(-1.28)
• The FIX function returns only the integer part after truncating the fractional part of an
Description
integer.
• The FIX function is different from the INT function, and the fractional part is truncated by
the FIX function even if the argument (X) is negative.
• FIX(X) is equivalent to (SGN(X)) X (INT(ABS(X))).
Example
Program Example
10 ' The fractional part of the numeric value is truncated
20 A=3.95
30 B=-3.95
40 C=FIX(A!)
50 D=FIX(B!)
60 PRINT "
A=";A,"
70 PRINT "FIX(A)=";C,"FIX(B)=";D
80 END
RUN
A= 3.95
B=-3.95
FIX(A)= 3
FIX(B)=-3
OK
11 - 69
FIX
• • • •
• • • •
-1
• • • •
B=";B
REMARK
See the CINT and INT functions, Sections 2.7.1 and 2.8.1.
Specify a numeric value to truncating the fractional
part.
Returns 1 after truncating the fractional part of 1.28.
Returns -1 after truncating the fractional part of -1.28.
X=-3.54
(SGN(-3.54))
(INT(ABS(-3.54)))
INT(absolute value 3.54)
(Sign -1)
(3 after truncating the fractional part) =-3
:
' Defines the numeric value
:
' The fractional part of A is truncated and
stored in C
:
' The fractional part of B is truncated and
stored in D
:
' Numeric value after the fractional part is
truncated
MELSEC-Q
11 - 69

Advertisement

Table of Contents
loading

This manual is also suitable for:

Ad51h-s3Qd51-r24A1sd51s

Table of Contents