Operators

23.08.2021

In FPScript you can use a variety of operators, e.g. for arithmetical and logical operations, comparison and concatenation operations. You can use the operators to calculate individual values or entire data sets, data matrices, signals, signal series or space curves.

Operator Precedence

If several operators occur in an expression, each part is evaluated and resolved in a predefined order. This order is described as operator precedence. You can override the operator precedence using parentheses to force the evaluation of parts of an expression before other components. Operations in parentheses are always executed before the operations that are not in parentheses. However, standard operator precedence also applies within the parentheses.

If an expression contains operators of different categories, then these are evaluated in the order specified below. All comparison operators have the same priority, i.e. they are evaluated from left to right in their order of appearance. Arithmetical and logical operators are evaluated in the following order:

Description

Symbol

Conversion

Convert to Boolean Value

Boolean Value

Convert to 16-Bit Integer

Integer16

Convert to 32-Bit Integer

Integer32

Convert to 64-Bit Integer

Integer64

Convert to 32-Bit Floating Point Value

FloatingPoint32

Convert to 64-Bit Floating Point Value

FloatingPoint64

Convert to Complex 16-Bit Integer

ComplexInteger16

Convert to Complex 32-Bit Integer

ComplexInteger32

Convert to Complex 64-Bit Integer

ComplexInteger64

Convert to Complex 32-Bit Floating Point Value

ComplexFloatingPoint32

Convert to Complex 64-Bit Floating Point Value

ComplexFloatingPoint64

Convert to String

String

Convert to Calendar Time

CalendarTime

Convert to Time Span

TimeSpan

Convert unit

Unit

Convert quantity to value

Value

Arithmetic

Unary Negation

-

Exponentiation

^

Multiplication

*

Division

/

Division Remainder

%

Addition

+

Subtraction

-

Operational Sign

#

Complex Numbers

Form Real Component

Real

Form Imaginary Component

Imag

Form Conjugate-Complex Number

*

Comparison *

Less Than

<

Greater Than

>

Less Than or Equal To

<=

Greater Than or Equal To

>=

Equality

==

Inequality

<>

Logical

Binary Negation

~

Binary Conjunction

&

Binary Exclusion

XOr

Binary Disjunction

|

Logical Negation *

Not

Logical Conjunction *

And

Logical Disjunction *

Or

Data Organization

Concatenation

:

Multiply

#

Form Complex Number

( , )

Bundle

{ , }

Form Data Series

( , , )

Form List

[ , ]

Data Access

Component

.X .Y .Z

Property

.

List Element

.[ ]

Index

[ , ] [[ , ]]

Indirection *

$$

If multiplication and division occur in an expression, each operation is executed from left to right in the order of appearance. The same procedure applies when addition and subtraction or concatenation and multiplying occur in an expression.

Associativity

The exponentiation operator is the only operator that is right-associative. This means that several exponentiations are processed in sequence from right to left. All other operators are processed from left to right.

Processing Logical Expressions

A logical conjunction (Boolean AND operation), or sequences from it are only evaluated until the result is defined, i.e. until the first expression results in FALSE. The same applies to the logical disjunction (OR operation). These are evaluated until the first expression results in TRUE. This does not apply to the bitwise logical operations.

In the following example, Test(DataSet2) is only called when Test(DataSet1) results in true. If Test(DataSet1) results in FALSE, then the final result of the Boolean AND operation is defined as FALSE.

If Test(DataSet1) And Test(DataSet2) Then
    ...
End

* This operator and all operators of this category are not available in FlexPro View.

Share article or send as email:

You might be interested in these articles