Core.Terms.MathematicalOperations
(Redirected from MathematicalOperations)
Jump to navigation
Jump to search
Contents
Classification
Name | MathematicalOperations |
Short Description | Basic mathematical operators |
Class | Term |
Extension | OTX Core library |
Group | Operations |
Exceptions | - |
Checker Rules | - |
Standard Compliant | Yes |
OTL Syntax
NumericValue = NumericTerm1 + NumericTerm2 + NumericTerm3 + ...
NumericValue = NumericTerm1 - NumericTerm2
NumericValue = NumericTerm1 * NumericTerm2 * NumericTerm3 + ...
NumericValue = NumericTerm1 / NumericTerm2
NumericValue = NumericTerm1 % NumericTerm2
NumericValue = |NumericTerm1|
NumericValue = Round(NumericTerm1)
NumericValue = Negate(NumericTerm1)
Description
Some of the mathematical operators are used according to the C# notation for mathematical operations. The following operators can be used:
- +
- Plus, the result is the numerical sum of two or more operands.
- -
- Minus, the result is the numerical subtraction of the left and right operands.
- *
- Multiplication, the result is the numerical multiplication of two or more operands.
- /
- Division, the result is the numerical division of the left and right operands.
- %
- Modulus, that is result of the remainder of the integer division of left and right operands (applies only to type [Core.DataTypes.SimpleDataType.Integer|Integer]]).
The other operations which do not have operators are:
- |...|
- Absolutevalue, that returns the value of the operand without regard to its sign.
- Round(...)
- Round, that returns the rounded integer value of the operand.
- Negate(...)
- Negate, that returns the value of the operand with inverted sign.
Return Value
The Term returns the value, see table below.
![]()
In OTX, Terms are categorized according to its return data type!
Data Type | Description |
Integer, Float | Return value of mathematical operation. One operand is of type float return value is float. Otherwise, the return value of the type is integer. |
Properties
Add, Multiply:
Name | Data Type | Class | Default | Cardinality | Description |
Terms | Integer, Float | Term | - | [2..*] | The numeric operands (or summands) of the addition (Add) or the numeric term which represents the factor values (Multiply). Terms will be evaluated in the order of appearance. |
Subtract, Divide, Modulo:
Name | Data Type | Class | Default | Cardinality | Description |
NumericTerm1 | Integer, Float | Term | - | [1] | Left operand. |
NumericTerm2 | Integer, Float | Term | - | [1] | Right operand (Subtrahend of subtraction or Divisor of division or modulo. |
AbsoluteValue, Round, Negate:
Name | Data Type | Class | Default | Cardinality | Description |
NumericTerm2 | Integer, Float | Term | - | [1] | The numeric term whose absolute value will be returned (AbsoluteValue). The numeric term that will be rounded to the nearest integer towards plus infinity (Round) or will be negated (Negate). |
OTL Examples
/// Local Declarations
Integer MyValue1 = 1;
Integer MyValue2 = 5;
Integer Result1;
Float Result2;
/// Flow
Result1 = MyValue1 + MyValue2 + 2 + 1;
Result2 = MyValue1 + MyValue2 + 2 + 1.25;
Result1 = MyValue1 - MyValue2;
Result2 = MyValue1 - 222.2222;
Result1 = MyValue1 * 8 * MyValue2 * 3;
Result1 = MyValue1 * 8.1 * MyValue2 * 3.2;
Result2 = MyValue1 / 115;
Result2 = MyValue1 / 1.5;
Result1 = 17 % MyValue2;
Result2 = 17.5 % MyValue2;
Result1 = |-123456|;
Result2 = |-123.456|;
Result1 = Round(123.456);
Result1 = Negate(123456);
Result2 = Negate(123.456);