Click or drag to resize

Ceil Function

X#
Round a number up to the next highest integer.

Namespace:  XSharp.RT
Assembly:  XSharp.RT (in XSharp.RT.dll) Version: 2.21
Syntax
 FUNCTION Ceil(
	nNumber AS USUAL
) AS USUAL
Request Example View Source

Parameters

nNumber
Type: Usual
The number to round.

Return Value

Type: Usual
The integer part (no decimals) of the nearest number that is greater than or equal to nNumber. Since both nNumber and the return value are data type USUAL, you are not limited to the size of an integer.
Remarks
Ceil() rounds a positive number with a fractional portion up to the next highest integer and returns the integer portion of a negative number.
Examples
These examples illustrate Ceil() on a positive and a negative value:
X#
1? Ceil(1.6)            // 2
2? Ceil(-1.6)                // -1 (since -1 > -2)
See Also