Difference between revisions of "Core.Terms.MathematicalOperations"
Jump to navigation
Jump to search
Line 6: | Line 6: | ||
<syntaxhighlight lang="java" enclose="div" style="font-size: medium;"> | <syntaxhighlight lang="java" enclose="div" style="font-size: medium;"> | ||
NumericValue = NumericTerm1 operator NumericTerm2 | NumericValue = NumericTerm1 operator NumericTerm2 | ||
− | NumericValue = | + | NumericValue = |NumericTerm1| |
+ | NumericValue = round(NumericTerm1) | ||
+ | NumericValue = negate(NumericTerm1) | ||
</syntaxhighlight> | </syntaxhighlight> | ||
Revision as of 03:14, 7 May 2019
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 operator NumericTerm2
NumericValue = |NumericTerm1|
NumericValue = round(NumericTerm1)
NumericValue = negate(NumericTerm1)
Description
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.
- -
- Negation, the result is the negated value of the operands (E.g.: -1 or Variable1).
- *
- Multiplication, the result is the numerical multiplication of two or more operands.
- /
- Div, the result is the numerical division of the left and right operands.
- %
- Modulo, that is result of the remainder of the integer division of left and right operands (applies only to type Integer).
Return Value
The Term returns the value, see table below.
![]()
In OTX, Terms are categorized according to its return data type!
Data Type | Description |
NumericValue | 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
Integer MyValue1;
Integer MyValue2;
Float result;
result = MyValue1 + MyValue2;
result = MyValue1% MyValue2;
result = MyValue1 / MyValue2;