LTRUNC

LTRUNC 1:

The LTRUNC function determines the integral component of a floating point number.

Examples

LTRUNC(2.8) = 2
LTRUNC(-2.8) = -2

Similar functions: TRUNC, FLOOR

Note: Unlike TRUNC, the result from LTRUNC is of type LREAL and is therefore not limited to the value range of integer variables.

FUNCTION LTRUNC : LREAL

VAR_INPUT
    lr_in  : LREAL;
END_VAR

lr_in : Function parameters of type LREAL

Development environment

Target system type

PLC libraries to be linked

TwinCAT v2.9.0 build 1000 onwards

PC or CX (x86)

TcMath.Lib

TwinCAT v2.10.0 Build >= 1301

CX (ARM)

LTRUNC 2: