2 assignment expressions – ElmoMC SimplIQ Software Manual User Manual

Page 26

Advertising
background image

SimplIQ

Software Manual

The Interpreter Language

MAN-SIMSW (Ver. 1.4)

4-8

Examples:

Command Line

Results

Remarks

SP*2/5+AC

101,000

The order is ((SP*2)/5) + AC

IP|5

OR operation on IP

2+3

5

1,400,000

1,400,000

4.2.6.2 Assignment Expressions

Assignment expressions are used to assign a value to a variable or to a command. The
syntax of an assignment expression is:
<parameter or command name>=<simple expression>

Examples:
SP=SP*2/5+AC

OP=IP|5

If the variable or the command is a vector, the assignment is allowed only for its single
member. The syntax of the vector member assignment is:
<parameter or command name>[index]=<simple expression>

The index is an index of the relevant member vector. Indices are enumerated from zero.

Example:
CA[1]=1

Be aware that when different types are assigned, the value may be truncated. If, for
example, the variable or command type is integer and the assigned value is floating
point, the floating value is rounded to the nearest integer. If a rounded integer value
exceeds the integer range, this value is truncated to the nearest valid integer.

Example:


Expression Sent

Response
Received


Remarks

AC=12,345.6789

– Assign

floating

value

to integer AC command.

AC

12,346

Floating value rounded to nearest integer.

KV[10]=215.789e8

Assign floating value to integer KV[10]
command.

KV[10]

2,147,483,647

Floating value truncated to maximum integer
value.

When an integer value is assigned to a floating point command or variable, it is
converted to a float. The conversion process may be imprecise due to the truncation into
float IEEE format.

Advertising