2 mathematical and logical operators, Mathematical and logical operators -3 – ElmoMC SimplIQ Software Manual User Manual

Page 21

Advertising
background image

SimplIQ

Software Manual

The Interpreter Language

MAN-SIMSW (Ver. 1.4)

4-3

SimplIQ

drives cannot evaluate numbers with an absolute value greater than 10

20

. For

example, if you enter =12.3e+20 or -13.56e-20, the

SimplIQ

drive will respond with a

Badly Formatted Number error.

Logical operators yield 0 or 1 as a result.
The results of logical operators are integers.

4.2.2

Mathematical and Logical Operators

Expressions may contain any combination of arithmetic, relational and logical operators.
Precedence levels determine the order in which the expression is evaluated. Within each
precedence level, operators have equal precedence and are evaluated from left to right.
For example, a*b/c is equivalent to (a*b)/c.

The following table lists the mathematical and logical operators used in the

SimplIQ

drive

language. The table also specifies operator precedence, ordered from highest to lowest
precedence level.

Operator Description

Precedence

~

Bitwise NOT of an operand

17

!

Logical negation

17

-

Unary minus

17

%

Remainder after dividing two integers

16

*

Multiplication of two operands

16

/

Division of the left operand by the right operand

16

+

Addition of two operands

15

-

Subtraction of the right operand from the left operand

15

<<

Bitwise shift left

14

>>

Bitwise shift right

14

<

Logical smaller than

13

<=

Logical smaller than or equal to

13

>

Logical greater than

13

>=

Logical greater than or equal to

13

==

Logical equality

12

!=

Logical not equal

12

&

Bitwise AND between two operands

11

|

Bitwise OR between two operands

9

&&

Logical AND

8

||

Logical OR

7

=

Assignment

( )

Parentheses, for expression nesting and function calls

[ ]

Brackets, for array indices and multiple value function returns

Table

4-1: Mathematical and Logical Operators

Advertising