beautypg.com

2 expressions and operators, 1 numbers, 2 expressions and operators -2 – ElmoMC SimplIQ Software Manual User Manual

Page 20: Numbers -2

background image

SimplIQ

Software Manual

The Interpreter Language

MAN-SIMSW (Ver. 1.4)

4-2

Example:

Command Line

Results

Remarks

3+4;

7

PX=7; PX-3;

4

PX is set to 7 and 3 is then subtracted.

(3.2+4)/2;

3.6

4.2

Expressions and Operators

The drive language supports operators, which specify a mathematical, logical or
conditional operation/relation between two or more operands. Operands (or parameters)
and operators may be combined in almost any way to create an expression. The following
sections describe the operators and expression syntax rules.

4.2.1

Numbers

SimplIQ

drives use two number types: 32-bit integers and 32-bit floating-point numbers

(“floats”). At text inputs, numbers containing a decimal point or an exponent notation are
interpreted as floats. Other numbers are interpreted as integers.

The range for integers is [-2,147,483,648…2,147,483,647]. If an integer number exceeds the
integer range, it is interpreted as an error. For example, if 2,147,483,648 is entered, the

SimplIQ

drive will respond with a Bad Command Format error.

The lowest integer – -2,147,483,648 – cannot be entered explicitly through the

interpreter due to the means by which immediate numbers are internally
evaluated. Nevertheless, this integer value is valid and can be entered in
hexadecimal form as 0x80,000,000.

Positive integers may be written as decimal or as hexadecimal.
The hexadecimal notation 0x10 is equivalent to the decimal number 16.
An integer value is always truncated to the nearest lower number. For example, 5/2 is 2,
whereas 5/2.0 is 2.5. If an integer exceeds the integer range, it is interpreted as an error.

The range for floating-point numbers is [-1e20…1e20].
A floating-point number may be written with or without an exponent.
2.5e4 is equivalent to 25,000.0. It is not equivalent to 25,000, because the latter number is
interpreted as an integer. If a floating-point number exceeds the floating-point range, it is
also interpreted as an error.

SimplIQ

drives evaluate floating-point numbers with the standard IEEE floating

point precision of approximately six significant decimal digits. For example, the
number 12,345.0 has an exact IEEE floating point representation. The number
1,234,568.0 is understood by the

SimplIQ

drive to be 12,345,680.0 due to truncation

into float IEEE format.