11 - 99 11 - 99
MELSEC-Q
11 INSTRUCTIONS AND FUNCTIONS
Program Example
10 ' Differences of calculation results among INT, FIX and CINT functions
20 DIM A(3)
:
' Defines an array
30 A(0)=12.34
:
' Stores the value
40 A(1)=12.56
50 A(2)=-12.34
60 A(3)=-12.56
70 FOR I=0 TO 3
:
' Repeats with I=0 to 3
80 PRINT "A(";I;")=";A(I)
:
' Displays the original value
90 PRINT "INT =";INT(A(I))
:
' Displays the result of conversion by the
INT function
100 PRINT "FIX =";FIX(A(I))
:
' Displays the result of conversion by the
FIX function
110 PRINT "CINT=";CINT(A(I))
:
' Displays the result of conversion by the
CINT function
120 PRINT
130 NEXT I
140 END
RUN
A( 0 )= 12.34
INT = 12
FIX = 12
CINT= 12
A( 1 )= 12.56
INT = 12
FIX = 12
CINT= 12
A( 2 )=-12.34
INT =-13
FIX =-12
CINT=-13
A( 3 )=-12.56
INT =-13
FIX =-12
CINT=-13
OK
REMARK
See the CINT and FIX functions.