Previous Table of Contents "New C Standard" commentary

702 Many operators that expect operands of arithmetic type cause conversions and yield result types in a similar way.

703
The purpose is to determine a *common real type* for the
operands and result.

704 For the specified operands, each operand is converted, without change of type domain, to a type whose corresponding real type is the common real type.

705 Unless explicitly stated otherwise, the common real type is also the corresponding real type of the result, whose type domain is the type domain of the operands if they are the same, and complex otherwise.

706
This pattern is called the *usual arithmetic conversions*:

707
First, if the corresponding real type of either operand is

708
Otherwise, if the corresponding real type of either operand is

709
Otherwise, if the corresponding real type of either operand is
^{51)}

710 Otherwise, the integer promotions are performed on both operands.

711 Then the following rules are applied to the promoted operands:

712 If both operands have the same type, then no further conversion is needed.

713 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.

714 Otherwise, if the operand that has unsigned integer type has rank greater or equal to the rank of the type of the other operand, then the operand with signed integer type is converted to the type of the operand with unsigned integer type.

715 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, then the operand with unsigned integer type is converted to the type of the operand with signed integer type.

716 Otherwise, both operands are converted to the unsigned integer type corresponding to the type of the operand with signed integer type.

717 The values of floating operands and of the results of floating expressions may be represented in greater precision and range than that required by the type;

718
the types are not changed thereby.^{52)}

719
51) For example, addition of a

720 52) The cast and assignment operators are still required to perform their specified conversions as described in 6.3.1.4 and 6.3.1.5.

Created at: 2008-01-30 02:39:41 The text from WG14/N1256 is copyright © ISO