संपादित करें

इसके माध्यम से साझा किया गया


IntDiv (NoSQL query)

APPLIES TO: NoSQL

Divides the left-hand operator by the right-hand operator. For more information, see multiplicative operators.

Syntax

IntDiv(<int_expr_1>, <int_expr_2>)

Arguments

Description
int_expr_1 An integer expression, which is used as the left-hand operand.
int_expr_2 An integer expression, which is used as the right-hand operand.

Return types

Returns a 64-bit integer.

Note

For more information, see __int64.

Examples

This example tests the function with various static values.

SELECT VALUE {
    divide: IntDiv(10, 2),
    negativeResult: IntDiv(10, -2),
    positiveResult: IntDiv(-10, -2),
    resultOne: IntDiv(10, 10),
    divideZero: IntDiv(10, 0),
    divideDecimal: IntDiv(10, 0.1)
}
[
  {
    "divide": 5,
    "negativeResult": -5,
    "positiveResult": 5,
    "resultOne": 1
  }
]

Remarks

  • This function expects integers for both arguments and performs operations assuming the values are a 64-bit integer.
  • If any of the arguments aren't an integer, the function returns undefined.
  • Overflow behavior is similar to the implementation in C++ (wrap-around).
  • Multiplicative operators have left-to-right associativity.

See also