# 7 Expressions [expr]

## 7.4 Usual arithmetic conversions [expr.arith.conv]

Many binary operators that expect operands of arithmetic or enumeration type cause conversions and yield result types in a similar way.
The purpose is to yield a common type, which is also the type of the result.
This pattern is called the usual arithmetic conversions, which are defined as follows:
• If either operand is of scoped enumeration type, no conversions are performed; if the other operand does not have the same type, the expression is ill-formed.
• Otherwise, if either operand is of floating-point type, the following rules are applied:
• If both operands have the same type, no further conversion is needed.
• Otherwise, if one of the operands is of a non-floating-point type, that operand is converted to the type of the operand with the floating-point type.
• Otherwise, if the floating-point conversion ranks ([conv.rank]) of the types of the operands are ordered but not equal, then the operand of the type with the lesser floating-point conversion rank is converted to the type of the other operand.
• Otherwise, if the floating-point conversion ranks of the types of the operands are equal, then the operand with the lesser floating-point conversion subrank ([conv.rank]) is converted to the type of the other operand.
• Otherwise, the expression is ill-formed.
• Otherwise, the integral promotions ([conv.prom]) are performed on both operands.50
Then the following rules are applied to the promoted operands:
• If both operands have the same type, no further conversion is needed.
• Otherwise, if both operands have signed integer types or both have unsigned integer types, the operand with the type of lesser integer conversion rank is converted to the type of the operand with greater rank.
• Otherwise, if the operand that has unsigned integer type has rank greater than or equal to the rank of the type of the other operand, the operand with signed integer type is converted to the type of the operand with unsigned integer type.
• Otherwise, if the type of the operand with signed integer type can represent all of the values of the type of the operand with unsigned integer type, the operand with unsigned integer type is converted to the type of the operand with signed integer type.
• Otherwise, both operands are converted to the unsigned integer type corresponding to the type of the operand with signed integer type.
If one operand is of enumeration type and the other operand is of a different enumeration type or a floating-point type, this behavior is deprecated ([depr.arith.conv.enum]).
50)50)
As a consequence, operands of type bool, char8_­t, char16_­t, char32_­t, wchar_­t, or of enumeration type are converted to some integral type.