You can use arithmetic, relational, assignment, comma, conditional,
equality, logical, primary, and unary cast operators on a decimal
data type. Conversions follow these arithmetic conversion rules:
- First, if the type of either operand is long double, the other
operand becomes long double.
- Otherwise, if the type of either operand is double, the other
operand becomes double.
- Otherwise, if the type of either operand is float, the other operand
becomes float.
- Otherwise, if the type of either operand is decimal, the other
operand becomes decimal.
- Otherwise, the integral promotions are performed on both operands.
Then the following rules are applied:
- If the type of either operand is unsigned long int, the other
operand becomes unsigned long int.
- Otherwise, if the type of one operand is long int and the other
is unsigned int, the operand of type unsigned int is converted to
long int, if the long int can represent all values of an unsigned
int. If a long int cannot represent all the values of an unsigned
int, both operands become unsigned long int.
- Otherwise, if the type of either operand is long int, the other
operand becomes long int.
- Otherwise, if the type of either operand is unsigned int, the
other operand becomes unsigned int.
- Otherwise, the type of both operands is int.