Return number closest to its argument.
The following construct(s) refer to this construct:
fn:round(double? $number) => double?
This function returns the number that is closest to $number
.
More precisely, fn:round(x)
returns the same result as
fn:floor(x + 0.5)
. If the argument is the empty sequence, it
returns the empty sequence. If the argument is a literal, then the literal must
be a valid lexical form of its type.
$number |
double-precision number |
---|
Call function with the numeric value 41.5
:
round(41.5E0)
round(xs:double("41.7"))
In both cases the double-precision number 4.2E1
is
returned. In the first query the argument is a valid literal of the required
type, in the second query the required type is constructed using the
constructor function xs:double
.
Call function with the numeric value -273.15
:
round(-273.15E0)
This query returns -2.73E2
.