Skip to content

Instantly share code, notes, and snippets.

@xquery
Created May 5, 2011 10:24
Show Gist options
  • Select an option

  • Save xquery/956835 to your computer and use it in GitHub Desktop.

Select an option

Save xquery/956835 to your computer and use it in GitHub Desktop.
idiv operator in xquery
xquery version "1.0";
(: The idiv operator returns an integer as a result, rounding toward 0. :)
let $a as xs:decimal := 20.1
let $b as xs:decimal := 1.678
let $result := $a idiv $b
return
$result
(: the precise result is 11.978545887961859 but idiv returns 11 :)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment