3 maxl additive operators, Expressions formed with binary operators – ElmoMC Multi-Axis Motion Controller-Maestro User Manual

Page 79

Advertising
background image

Syntax

multiplicative-expression

:

expression * expression
expression / expression
expression % expression

expression:

multiplicative-expression

The multiplicative operators take operands of arithmetic types. The modulo operator
(%) has a stricter requirement in that its operands must be integer type.

The multiplication operator yields the result of multiplying the first operand by the
second.

The division operator yields the result of dividing the first operand by the second.

The modulo operator yields the remainder given by the following expression, where
e1 is the first operand and e2 is the second: e1 – (e1 / e2) * e2, where both operands are
of integer types.

Division by 0 in either a division or a modulo expression is undefined and causes a
run-time error. Therefore, the following expressions generate undefined, erroneous
results:

i % 0
f / 0.0

If both operands to a multiplication, division, or modulo expression have the same
sign, the result is positive. Otherwise, the result is negative. The result of a modulo
operation’s sign is implementation-defined

5.4.1.4.2

5.4.1.4.3 MAXL Additive Operators

The additive operators are:

• Addition (+)
• Subtraction (–)

These binary operators have left-to-right associativity.

Syntax

additive-expression :

expression + expression
expression –expression

expression:

additive-expression

The additive operators take operands of arithmetic type. The result of the addition (+)
operator is the sum of the operands. The result of the subtraction (–) operator is the
difference between the operands.

Maestro

Software Manual

MAXL Program Language

MAN-MASSW (Ver. Q)

5-17

Advertising