FLOOR
The FLOOR function determines a integral value from a floating point number that is a fraction smaller than or equal that number. The resulting number is of type LREAL and is therefore not limited to the value range of integer variables.
Examples
FLOOR(2.8) = 2
FLOOR(-2.8) = -3
Similar functions: TRUNC, LTRUNC
Note: Unlike FLOOR, the LTRUNC function always determines the integral part of a number. For positive values, this number is smaller than or equal the input parameter, for negative values it is greater than or equal the input parameter.
FUNCTION FLOOR : 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) |
