ceil (Function)

Top  Previous  Next

Architecture:

X32 / NX32 / NX32L

Device support:

ALL

Firmware version:

3.10 / 1.00.00


This function will calculate the smallest integral value that is not smaller 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 smallest integral value as DOUBLE.

 

Declaration:

FUNCTION ceil : 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;