7 Calculations | 119
Data Type Deduction
Input signals have a defined type as can be seen in the type column of the Vari-
able Explorer. The types of intermediate results of a calculation formula are
chosen automatically depending on the input types and the applied operations.
This process is called type deduction.
Internally, a calculation operation is represented by multiple implementations
each with specific types for the inputs and outputs of the operation: the type
combinations. Type deduction works by choosing a type combination that
matches the inputs. Inputs may be converted to similar larger types if no exact
match can be found:
Signed integer to larger signed integer
Unsigned integer to larger unsigned integer
Any integer to 64 bit float
Boolean to any numeric
Examples:
Bit operations exist for signed and unsigned integers of all sizes. Type
deduction chooses the smallest size that is greater or equal than all inputs.
Arithmetic operations (plus, times, …) only exist in double so type deduc-
tion will always convert inputs to double.
7.2.4.2 Formula Syntax
Formulas are entered in textual form. A formula consists of the following types of
elements:
Literals: a constant value directly part of the formula, e.g. 1
Signals: a reference to an existing signal, represented by a box
Operators: a non-alphanumeric sequence of characters representing a cal-
culation operation e.g. +
Functions: e.g. sin()
Literals
A literal is the textual representation of a constant in a formula. The following
types of literals can be used:
Type Example
Decimal integer number 123
Decimal floating point number 1.23
Hexadecimal number 0x1FA, 0x1fa
Binary number (e.g. bitmask) 0b1001010
MDA V8 | User Guide