From Jason Turner

[expr.arith.conv]

Diff to HTML by rtfpessoa

Files changed (1) hide show
  1. tmp/tmp_nyi86or/{from.md → to.md} +28 -24
tmp/tmp_nyi86or/{from.md → to.md} RENAMED
@@ -7,36 +7,40 @@ This pattern is called the *usual arithmetic conversions*, which are
7
  defined as follows:
8
 
9
  - If either operand is of scoped enumeration type [[dcl.enum]], no
10
  conversions are performed; if the other operand does not have the same
11
  type, the expression is ill-formed.
12
- - If either operand is of type `long double`, the other shall be
13
- converted to `long double`.
14
- - Otherwise, if either operand is `double`, the other shall be converted
15
- to `double`.
16
- - Otherwise, if either operand is `float`, the other shall be converted
17
- to `float`.
18
- - Otherwise, the integral promotions [[conv.prom]] shall be performed on
19
- both operands.[^9] Then the following rules shall be applied to the
20
- promoted operands:
21
  - If both operands have the same type, no further conversion is
22
  needed.
23
- - Otherwise, if both operands have signed integer types or both have
24
- unsigned integer types, the operand with the type of lesser integer
25
- conversion rank shall be converted to the type of the operand with
26
- greater rank.
27
- - Otherwise, if the operand that has unsigned integer type has rank
28
- greater than or equal to the rank of the type of the other operand,
29
- the operand with signed integer type shall be converted to the type
30
- of the operand with unsigned integer type.
31
- - Otherwise, if the type of the operand with signed integer type can
32
- represent all of the values of the type of the operand with unsigned
33
- integer type, the operand with unsigned integer type shall be
34
- converted to the type of the operand with signed integer type.
35
- - Otherwise, both operands shall be converted to the unsigned integer
36
- type corresponding to the type of the operand with signed integer
37
- type.
 
 
 
 
 
 
 
 
 
 
 
38
 
39
  If one operand is of enumeration type and the other operand is of a
40
  different enumeration type or a floating-point type, this behavior is
41
  deprecated [[depr.arith.conv.enum]].
42
 
 
7
  defined as follows:
8
 
9
  - If either operand is of scoped enumeration type [[dcl.enum]], no
10
  conversions are performed; if the other operand does not have the same
11
  type, the expression is ill-formed.
12
+ - Otherwise, if either operand is of floating-point type, the following
13
+ rules are applied:
 
 
 
 
 
 
 
14
  - If both operands have the same type, no further conversion is
15
  needed.
16
+ - Otherwise, if one of the operands is of a non-floating-point type,
17
+ that operand is converted to the type of the operand with the
18
+ floating-point type.
19
+ - Otherwise, if the floating-point conversion ranks [[conv.rank]] of
20
+ the types of the operands are ordered but not equal, then the
21
+ operand of the type with the lesser floating-point conversion rank
22
+ is converted to the type of the other operand.
23
+ - Otherwise, if the floating-point conversion ranks of the types of
24
+ the operands are equal, then the operand with the lesser
25
+ floating-point conversion subrank [[conv.rank]] is converted to the
26
+ type of the other operand.
27
+ - Otherwise, the expression is ill-formed.
28
+ - Otherwise, each operand is converted to a common type `C`. The
29
+ integral promotion rules [[conv.prom]] are used to determine a type
30
+ `T1` and type `T2` for each operand.[^9]
31
+ Then the following rules are applied to determine `C`:
32
+ - If `T1` and `T2` are the same type, `C` is that type.
33
+ - Otherwise, if `T1` and `T2` are both signed integer types or are
34
+ both unsigned integer types, `C` is the type with greater rank.
35
+ - Otherwise, let `U` be the unsigned integer type and `S` be the
36
+ signed integer type.
37
+ - If `U` has rank greater than or equal to the rank of `S`, `C` is
38
+ `U`.
39
+ - Otherwise, if `S` can represent all of the values of `U`, `C` is
40
+ `S`.
41
+ - Otherwise, `C` is the unsigned integer type corresponding to `S`.
42
 
43
  If one operand is of enumeration type and the other operand is of a
44
  different enumeration type or a floating-point type, this behavior is
45
  deprecated [[depr.arith.conv.enum]].
46