This is a rounding function which returns the smallest possible integer which is greater or equal to `X`.
This is a rounding function which returns the smallest possible integer
which is greater or equal to X.
Examples:
CEIL(3.14) // 4
CEIL(-3.14) // -3
Version history
1.1.0
 
hm
Changes
Changed:
- use
REAL_TO_INTinstead ofTRUNCfor compatibility reasons
show full history
1.0.0
 
hm
Changes
Added:
- original version
Overview
| kind | name | type | default | comment |
|---|---|---|---|---|
| input | X | REAL | input value |
Details
X
REALInput value.
Source code
Declarations
(*Returns the smallest possible integer which is greater or equal to `X`*)
FUNCTION index : INT
(*
* -----------------------------------------------------------------------------
* Name : index
* Version : 1.1.0
* Date : 2008-03-21
* Author : hm
*
* -----------------------------------------------------------------------------
* Returns the smallest possible integer which is greater or equal to `X`
* -----------------------------------------------------------------------------
*)
VAR_INPUT
X : REAL; (*input value*)
END_VAR
Logic
CEIL := REAL_TO_INT(x);
IF CEIL < X THEN
CEIL := CEIL + 1;
END_IF;
Implementation
Snippet of the function call:
dummy := CEIL(
X := );