3.8. Arithmetic Conversions

Adding complex and long long types to the C and C++ languages affects the usual arithmetic conversions as specified in the standard. As a result, conversions are performed as follows on Cray Research machines:

  1. If one operand is long double complex, the other operand is converted to long double complex, and the result is long double complex.

  2. Else, if one operand is float complex or double complex and the other is long double, both are converted to long double complex and the result is long double complex.

  3. Else, if either operand is double complex, the other operand is converted to double complex, and the result is double complex.

  4. Else, if one operand is float complex and the other is double, both operands are converted to double complex, and the result is double complex.

  5. Else, if either operand is float complex, the other operand is converted to float complex, and the result is float complex.

  6. Else, if either operand is long double, the other is converted to long double, and the result is long double.

  7. Else, if either operand is double, both are converted to double, and the result is double.

  8. Else, if either operand is float, both are converted to float, and the result is float.

  9. Else, if the integral promotions are performed on both operands. Then:

    1. If either operand has type unsigned long long int, the other operand is converted to unsigned long long int, and the result is unsigned long long int.

    2. Else, if one operand has type long long int and the other has type unsigned long int, both operands are converted to unsigned long long int and the result is unsigned long long int.

    3. Else, if one operand has type long long int and the other has type unsigned int, both operands are converted to unsigned long long int and the result is unsigned long long int.

    4. Else, if either operand has type long long int, the other operand is converted to long long int, and the result is long long int.

    5. Else, if either operand is unsigned long, both are converted to unsigned long, and the result is unsigned long.

    6. Else, if one operand has type long int, and the other has type unsigned int, both operands are converted to unsigned long and the result is unsigned long.

    7. Else, if either operand is long, the other is converted to long, and the result is long.

    8. Else, if either operand is unsigned int, the other is converted to unsigned int and the result is unsigned int.

    9. Else, both operands must be int, and the result is int.