fn:floor
Rounds $arg
downwards to a whole number.
Signature
fn:floor($arg as xs:numeric?) as xs:numeric?
Properties
This function is deterministic, context-independent, and focus-independent.
Rules
General rules: see Functions on numeric values.
The function returns the largest (closest to positive infinity) number with no
fractional part that is not greater 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.
Examples
The expression fn:floor(10.5)
returns 10
.
The expression fn:floor(-10.5)
returns -11
.