Expressions And Operators; Arithmetic Operators - Mitsubishi QD51 Programming Manual

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

Advertisement

2 THE BASICS OF AD51H-BASIC

2.10 Expressions and Operators

2.10.1 Arithmetic operators

2 - 18
(4) When a numeric value of fixed decimal point format is converted to an integer, the
decimal fraction is disregarded.
Example
10 C%=55.88
20 PRINT C%
RUN
55
OK
(5) If a single-precision value is assigned to a double-precision variable, only the
rounded first seven digits of the converted numeric value will be valid. This is
because single-precision numeric values can hold an accuracy of up to seven
digits.
Example
10 A=2.04
20 B#=A
30 PRINT A;B#
RUN
2.04 2.039999961853027
OK
Expressions are simply constants or variables combined in order to obtain a character
string constant, numeric constant, variable, function, or a certain value. Numeric
expressions deal with numeric values and character string expressions deal with
character strings.
Operators perform arithmetic or logical operations on each value.
Operators can be classified into the following three types.
(1) Arithmetic operator
(2) Relational operator
(3) Logical operator
When one expression contains multiple arithmetic operators, the operation will be
performed in the following priority order.
Operator
^
*, /
+, -
Meaning
Power
Change sign
Multiplication, floating point division
Addition, subtraction
MELSEC-Q
Example
• • • • •
X^Y
• • • • •
–Y
• • • • •
X*Y, X/Y
• • • • •
X+Y
2 - 18

Advertisement

Table of Contents
loading

This manual is also suitable for:

Ad51h-s3Qd51-r24A1sd51s

Table of Contents