Syntax for expressions

The following subjects are mentioned below with regard to the syntax for expressions:

  • Variables, for example, Voltage
  • Operators, for example, Multiplication
  • Functions, for example, Rounding
  • Examples
VARIABLES

Variables are defined in the Algorithm Variables (qmptc0123m000) session and can be linked to characteristics in the Algorithm Variables (qmptc0122m000) session.

Variables are case sensitive and must be entered in uppercase to be regarded as proper variables.

Example
Correct1D, TA, V1, and so on
Incorrect1d, Ta, ta, v1, and so on

 

OPERATORS
Arithmetic operators:
* / + -multiplication/ division/ addition/ subtraction
\remainder after division
&linking strings (alphanumeric arrays)

 

Logical operators

or, and, not

Logical operators are used in Boolean expressions. These expressions are either true or not true. The logical value true corresponds to value 1 and the logical value not true corresponds to 0.

Relational Operators:
=equal to
<>not equal to
>greater than
>=greater than or equal to
<less than
<=less than or equal to

 

Assignment commands are recorded by means of :=

Priority in expressions:

  • Arithmetic operators have priority over relational operators
  • Relational operators have priority over logical operators
  • The priority sequence for arithmetic operators is: * / \ + -
  • The priority sequence for logical operators is: not, and, or
Note

These sequences can be modified by means of round brackets.

Example
 3 + 4 * 5 = 23 (3 + 4) * 5 = 35 
FUNCTIONS
Arithmetic functions:
round(X,Y,Z)round off X value
-Y the number of decimals
-Z rounding method (down = 0, normal = 1, up = 2)
abs(X)absolute value of X (abs(-10.3) = 10.3)
int(X)full value of X (int(11.6) = 11 )
pow(X,Y)involution (pow(10,2) = 100 )
sqrt(X)root of X (sqrt(16) = 4 )
min(X,Y)smallest values of X and Y (min(6,10) = 6 )
max(X,Y)largest values of X and Y (max(6,10) = 10 )
piconstant with PI value (3.1415926... )

 

Goniometric functions:
sin(X), cos(X), tan(X)sine, cosine, or tangent of X (radians)
asin(X), acos(X), atan(X)arcsine, arccosine, or arctangent of X
hsin(X), hcos(X), htan(X)sine-, cosine-, or tangent-hyperbolicus of X

 

Logarithmic functions:
exp(X)e-power of X
log(X)natural logarithm of X with base e
log10(X)logarithmic value of X with base 10
timecurrent time
datecurrent date
date(d,m,y)date expressed as day, month, and year

 

For example, date(1,5,1991) = May 1 1991

Date functions:
timecurrent time
datecurrent date
date(d,m,y)date expressed as day, month, and year

 

For example, date(1,5,1991) = May 1 1991

exp(X)e-power of X
log(X)natural logarithm of X with base e
log10(X)logarithmic value of X with base 10

 

Example
 5 IN [12,30] = 0 15 IN [12,30] = 1