TRUNC_INT

General Information

For general hints to be considered during type conversion, refer to the chapter Type Conversion Functions.

Definition

IEC operator for conversions from REAL to INT. The whole number portion of the value will be used.

The result of these functions is not defined if the input value cannot be represented with an INT. The behavior for such input values is platform-dependent.

Examples in ST

Examples in ST with conversion results:

Example

Result

iVar:=TRUNC_INT(1.9);

1

iVar:=TRUNC_INT(-1.4);

–1

Example in IL

LD                1.9
TRUNC_INT
ST                iVar