数值运算符Numerical operators

类型 intlongreal 表示数值类型。The types int, long, and real represent numerical types. 可以在这些类型对之间使用以下运算符:The following operators can be used between pairs of these types:

运算符Operator 描述Description 示例Example
+ 添加Add 3.14 + 3.14, ago(5m) + 5m3.14 + 3.14, ago(5m) + 5m
- Subtract 0.23 - 0.22,0.23 - 0.22,
* 相乘Multiply 1s * 5, 2 * 21s * 5, 2 * 2
/ Divide 10m / 1s, 4 / 210m / 1s, 4 / 2
% 取模Modulo 4 % 2
< LessLess 1 < 10, 10sec < 1h, now() < datetime(2100-01-01)1 < 10, 10sec < 1h, now() < datetime(2100-01-01)
> GreaterGreater 0.23 > 0.22, 10min > 1sec, now() > ago(1d)0.23 > 0.22, 10min > 1sec, now() > ago(1d)
== 等于Equals 1 == 1
!= 不等于Not equals 1 != 0
<= Less or EqualLess or Equal 4 <= 5
>= Greater or EqualGreater or Equal 5 >= 4
in 等于某个元素Equals to one of the elements 请参阅此处see here
!in 不等于任何元素Not equals to any of the elements 请参阅此处see here

与模数运算符有关的注释Comment regarding the modulo operator

两个数字的取模始终在 Kusto 中返回一个小的非负数。The modulo of two numbers always returns in Kusto a "small non-negative number". 因此,两个数字的取模(“N” % “D”)如下 :0 ≤ (N % D) < abs(D).Thus, the modulo of two numbers, N % D, is such that: 0 ≤ (N % D) < abs(D).

例如,以下查询:For example, the following query:

print plusPlus = 14 % 12, minusPlus = -14 % 12, plusMinus = 14 % -12, minusMinus = -14 % -12

生成以下结果:Produces this result:

plusPlusplusPlus minusPlusminusPlus plusMinusplusMinus minusMinusminusMinus
22 1010 22 1010