6 expressions, 1 simple expressions, Expressions -7 – ElmoMC SimplIQ Software Manual User Manual
Page 25

SimplIQ
Software Manual
The Interpreter Language
MAN-SIMSW (Ver. 1.4)
4-7
Operator Description Returns
fix
Truncate to integer:
fix(3.8)
is 3
fix (-3.8)
is -3
Note:
If an input argument exceeds the long value
range, it will be limited to the maximum long
value (for positive numbers) or the minimum
long value (for negative numbers).
Integer
rnd
Truncate to nearest integer:
rnd(3.8)
is 4
rnd(-3.8)
is -4
rnd(3.4)
is 3
Note:
If an input argument exceeds the long value
range, it will be limited to the maximum long
value (for positive numbers) or the minimum
long value (for negative numbers).
Integer
sign
Returns the sign of the input argument:
-1 for negative numbers, 1 for positive
numbers and zero for a zero.
sign (-3.8)
is -1
sign (3.8)
is 1
Integer
real
Convert integer to float. If argument is
floating point number, the function does
nothing:
5/2
is 2
real (5)/2
is 2.5
5/real (2)
is 2.5
Floating point
Table
4-3: Mathematical Functions
4.2.6
Expressions
An expression is a combination of operands (parameters) and operators that is evaluated
in a single value. Expressions work with immediate numbers, drive commands, and
drive and global user-program variables. The following sections describe the different
types of expressions.
4.2.6.1 Simple Expressions
A simple expression is evaluated in a single value. Any parameter and mathematical/
logical operator may be used to create a simple expression. Normally, simple expressions
may be used as a part of other types of expressions.
Simple expressions are evaluated according to the operator priority, as specified in
. In case of equal priorities, the expression is evaluated from left to right. The
use of parentheses is allowed to 16 nesting levels.