2 - 18 2 - 18
MELSEC-Q
2 THE BASICS OF AD51H-BASIC
(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
2.10 Expressions and Operators
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
2.10.1 Arithmetic operators
When one expression contains multiple arithmetic operators, the operation will be
performed in the following priority order.
Operator
Meaning
Example
^
Power
• • • • •
X^Y
–
Change sign
• • • • •
–Y
*, /
Multiplication, floating point division
• • • • •
X*Y, X/Y
+, -
Addition, subtraction
• • • • •
X+Y