Numeric Functions
abs
abs($arg as numeric) as numeric
Returns the absolute value of $arg.
abs(-5) → 5avg
avg($arg as xs:anyAtomicType*) as xs:anyAtomicType?
Returns the average of the values in $arg.
avg((1, 2, 3, 4)) → 2.5ceiling
ceiling($arg as numeric) as numeric
Returns the smallest integer greater than or equal to $arg.
ceiling(3.2) → 4floor
floor($arg as numeric) as numeric
Returns the largest integer less than or equal to $arg.
floor(3.8) → 3max
max($arg as xs:anyAtomicType*) as xs:anyAtomicType?
Returns the maximum value from a sequence.
max((1, 5, 3)) → 5min
min($arg as xs:anyAtomicType*) as xs:anyAtomicType?
Returns the minimum value from a sequence.
min((1, 5, 3)) → 1number
number($arg as xs:anyAtomicType?) as xs:double
Converts the argument to a double.
round
round($arg as numeric?) as numeric?
Rounds to the nearest integer (0.5 rounds up).
round(2.5) → 3round-half-to-even
round-half-to-even($arg as numeric?) as numeric?
round-half-to-even($arg as numeric?, $precision as xs:integer) as numeric?
Rounds to the given precision using banker’s rounding (half-to-even).
round-half-to-even(2.5) → 2
round-half-to-even(3.5) → 4sum
sum($arg as xs:anyAtomicType*) as xs:anyAtomicType
Returns the sum of the values in $arg.
sum((1, 2, 3)) → 6format-number
format-number($value as numeric, $picture as xs:string) as xs:string
format-number($value as numeric, $picture as xs:string, $name as xs:string) as xs:string
Formats a number as a string according to the picture string.
format-number(1234.5, '#,##0.00') → "1,234.50"format-integer
format-integer($value as xs:integer, $picture as xs:string) as xs:string
Formats an integer according to the picture string.
format-integer(42, 'w') → "forty-two"