Please enable JavaScript to view this site.

ESL Documentation

You can specify the following arithmetic operators in an expression:

 

Operator

Meaning

Example

Unary:

-

Minus

-5

Binary:

*

Multiplication

Base * 100

/

Division

Total / Unit

 

 

 

mod

Modulo

(remainder of

integer division)

C mod 12

+

Addition

A + 10

-

Subtraction

Num2 - 8

 

The unary minus operator simply reverses the sign of the value specified as the operand, and generates an integer or floating point result. Each of the binary operators arithmetically combines two operands and generates an integer or floating point result.

 

Operands in arithmetic expressions must be integer or floating point values. Do not specify string or boolean values with arithmetic operators; if you do, ESL generates an error message and does not convert the value.

 

When the division operator (/) is used with an integer operand, but assigned to a floating point variable or constant, a floating point value results; for example:

 

copy (3/2) to FP_Var    # 1.00 will be copied to FP_Var.

 

The actual computation in this expression is performed with integer math, because all operands are integers. If one or more of the operands is a floating point value, a floating point computation is performed. For example:

 

copy (3/2.0) to FP_Var   # 1.50 will be copied to FP_Var.

 

copy (3.0/2) to FP_Var   # 1.50 will be copied to FP_Var. 

 

The mod operator can be used only with integer values; otherwise, an error message is produced.