Arithmetic conversions are used for matching operands of arithmetic operators, and proceed in the following order:
Operand Type | Conversion |
---|---|
One operand has long double type | The other operand is converted to long double type. |
One operand has double type | The other operand is converted to double. |
One operand has float type | The other operand is converted to float. |
One operand has unsigned long long int type | The other operand is converted to unsigned long long int. |
One operand has long long int type | The other operand is converted to long long int. |
One operand has unsigned long int type | The other operand is converted to unsigned long int. |
One operand has unsigned int type and the other operand has long int type and the value of the unsigned int can be represented in a long int | The operand with unsigned int type is converted to long int. |
One operand has unsigned int type and the other operand has long int type and the value of the unsigned int cannot be represented in a long int | Both operands are converted to unsigned long int |
One operand has long int type | The other operand is converted to long int. |
One operand has unsigned int type | The other operand is converted to unsigned int. |
Both operands have int type | The result is type int. |
Note: The rules for arithmetic conversions in extended mode are different.