# op:numeric-integer-divide - XPath XQuery Reference

Performs an integer division.Defines the semantics of the "idiv" operator when
         applied to two numeric values.General rules: see .If $arg2 is INF or -INF, and $arg1
            is not INF or -INF, then the result is zero.Otherwise, subject to limits of precision and overflow/underflow conditions, the result
            is the largest (furthest from zero) xs:integer value $N such
            that the following expression is true:fn:abs($N * $arg2) le fn:abs($arg1) 
               and fn:compare($N * $arg2, 0) eq fn:compare($arg1, 0).The second term in this condition ensures that the result has the correct sign.The implementation may adopt a different algorithm provided that it is equivalent to
            this formulation in all cases where implementation-dependent or implementation-defined behavior does not affect the outcome, for example,
            the implementation-defined precision of the result of xs:decimal
            division.op:numeric-integer-divide(10,3)3op:numeric-integer-divide(3,-2)-1op:numeric-integer-divide(-3,2)-1op:numeric-integer-divide(-3,-2)1op:numeric-integer-divide(9.0,3)3op:numeric-integer-divide(-3.5,3)-1op:numeric-integer-divide(3.0,4)0op:numeric-integer-divide(3.1E1,6)5op:numeric-integer-divide(3.1E1,7)4A dynamic error is raised  if the divisor is (positive
            or negative) zero.A dynamic error is raised  if either operand is
               NaN or if $arg1 is INF or
            -INF.Except in situations involving errors, loss of precision, or overflow/underflow, the
            result of $a idiv $b is the same as ($a div $b) cast as
               xs:integer.The semantics of this function are different from integer division as defined in
            programming languages such as Java and C++.