floor (Function)

Top  Previous  Next

Architecture:

X32 / NX32 / NX32L

Device support:

ALL

Firmware version:

3.10 / 1.00.00


This function will calculate the largest integral value that is not larger than the value.

 

Note: This function works with DOUBLE, but can also work with FLOAT as described in the Floating-point math introductory section.

 

Input:

V : DOUBLE

Value to convert.

 

Returns: DOUBLE

The largest integral value as DOUBLE.

 

Declaration:

FUNCTION floor : DOUBLE;
VAR_INPUT
v : DOUBLE;
END_VAR;

 

 

Example:

INCLUDE rtcu.inc
INCLUDE math.inc
 
PROGRAM test;
 
DebugFmt(message := "ceil  99.9999 = " + doubleToStr(v:= ceil(v:=99.9999)));
DebugFmt(message := "floor 99.9999 = " + doubleToStr(v:= floor(v:=99.9999)));
 
END_PROGRAM;