XPath/XQuery ceiling function


Rounds $arg upwards to a whole number.


$arg as xs:numeric?
) as xs:numeric?


This function is deterministic, context-independent, and focus-independent.


General rules: see .

The function returns the smallest (closest to negative infinity) number with no fractional part that is not less than the value of $arg.

For the four types xs:float, xs:double, xs:decimal and xs:integer, it is guaranteed that if the type of $arg is an instance of type T then the result will also be an instance of T. The result may also be an instance of a type derived from one of these four by restriction. For example, if $arg is an instance of xs:decimal then the result may be an instance of xs:integer.

For xs:float and xs:double arguments, if the argument is positive zero, then positive zero is returned. If the argument is negative zero, then negative zero is returned. If the argument is less than zero and greater than -1, negative zero is returned.


The expression fn:ceiling(10.5) returns 11.

The expression fn:ceiling(-10.5) returns -10.