Operator: TRUNC_INT
The IEC operator is used for converting the REAL data type into the INT data type. takes only the integer part of the number.
Tip
TRUNC_INT corresponds to the TRUNC operator in , and it is used automatically at this point when importing V2.3 projects. Note the change function of TRUNC in V3.
If cannot represent the input value by a DINT or INT, then the result of this function is undefined. The behavior of such input values is platform-dependent.
Example 179. Example
ST
iVar := TRUNC_INT(1.9); (* Result: 1 *) iVar := TRUNC_INT(-1.4); (* Result: -1 *)