# 常用算术转换Usual Arithmetic Conversions

1. 如果任一操作数是 `long double` 类型，则将另一个操作数转换为 `long double` 类型。If either operand is of type `long double`, the other operand is converted to type `long double`.

2. 如果未满足上述条件，并且任一操作数是 double 类型，则将另一个操作数转换为 double 类型。If the above condition is not met and either operand is of type double, the other operand is converted to type double.

3. 如果未满足上述两个条件，并且任一操作数是 float 类型，则将另一个操作数转换为 float 类型。If the above two conditions are not met and either operand is of type float, the other operand is converted to type float.

4. 如果未满足上述三个条件（所有操作数都不是浮点型），则对操作数执行整型转换，如下所示：If the above three conditions are not met (none of the operands are of floating types), then integral conversions are performed on the operands as follows:

• 如果任一操作数是 `unsigned long` 类型，则将另一个操作数转换为 `unsigned long` 类型。If either operand is of type `unsigned long`, the other operand is converted to type `unsigned long`.

• 如果未满足上述条件，并且任一操作数是 long 类型且另一个操作数是 `unsigned int` 类型，则将两个操作数都转换为 `unsigned long` 类型。If the above condition is not met and either operand is of type long and the other of type `unsigned int`, both operands are converted to type `unsigned long`.

• 如果未满足上述两个条件，并且任一操作数是 long 类型，则将另一个操作数转换为 long 类型。If the above two conditions are not met, and either operand is of type long, the other operand is converted to type long.

• 如果未满足上述三个条件，并且任一操作数是 `unsigned int`类型，则将另一个操作数转换为 `unsigned int` 类型。If the above three conditions are not met, and either operand is of type `unsigned int`, the other operand is converted to type `unsigned int`.

• 如果未满足上述任何条件，则将两个操作数转换为 `int` 类型。If none of the above conditions are met, both operands are converted to type `int`.

以下代码阐释了这些转换规则：The following code illustrates these conversion rules:

``````float   fVal;
double  dVal;
int   iVal;
unsigned long ulVal;

dVal = iVal * ulVal; /* iVal converted to unsigned long
* Uses step 4.
* Result of multiplication converted to double
*/
dVal = ulVal + fVal; /* ulVal converted to float
* Uses step 3.
* Result of addition converted to double
*/
``````