Use arithmetic operators to perform calculations in X++. Except for ~, which is unary, all arithmetic operators are dyadic; that is, they work on two operands. The syntax of arithmetic expressions is: expression1ArithmeticOperatorexpression2.

Operator

Term

Description

<<

Left shift

Performs expression2 left shift (a multiplication by 2) on expression1.

>>

Right shift

Performs expression2 right shift (a division by 2) on expression1.

*

Multiply

Multiplies expression1 by expression2.

/

Divide

Divides expression1 by expression2.

DIV

Integer division

Performs an integer division of expression1 by expression2.

MOD

Integer remainder

Returns the remainder of an integer division of expression1 by expression2.