
MarkLogic 12 Product Documentation
vec:truncvec:trunc(
$vector as vec:vector,
[$n as xs:integer?]
) as vec:vector
Summary
Returns a new vector which is a copy of the input vector with each element truncated to a specific number of digits.
| Parameters |
| vector |
The input vector to truncate.
|
| n |
The numbers of decimal places to truncate to. The default is 0. Negative values cause that many digits to the left of the decimal point to be truncated.
|
Example
xquery version "1.0-ml";
let $vec := vec:vector((1.234,2.654))
return vec:trunc($vec, 2)
=> [ 1.23, 2.65 ]
Copyright © 2026 MarkLogic Corporation. MARKLOGIC is a
registered trademark of MarkLogic Corporation.