Click or drag to resize

Ceil Function

Round a number up to the next highest integer.

Namespace:  XSharp.RT
Assembly:  XSharp.RT (in XSharp.RT.dll) Version: 2.10
Syntax
 FUNCTION Ceil(
	nNumber AS USUAL
) AS USUAL
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#
? Ceil(1.6)                        // 2
? Ceil(-1.6)                                // -1 (since -1 > -2)
See Also