[conv.rank]

# 6 Basics [[basic]](./#basic)

## 6.9 Types [[basic.types]](basic.types#conv.rank)

### 6.9.6 Conversion ranks [conv.rank]

[1](#1)

[#](http://github.com/Eelis/draft/tree/9adde4bc1c62ec234483e63ea3b70a59724c745a/source/basic.tex#L6107)

Every integer type has an [*integer conversion rank*](#def:integer_conversion_rank) defined as follows:

- [(1.1)](#1.1)

  No two signed integer types other than char and signedchar (if char is signed) have the same rank, even if they have
the same representation[.](#1.1.sentence-1)

- [(1.2)](#1.2)

  The rank of a signed integer type is greater than the rank
of any signed integer type with a smaller width[.](#1.2.sentence-1)

- [(1.3)](#1.3)

  The rank of long long int is greater
than the rank of long int, which is greater than
the rank of int, which is greater than the rank ofshort int, which is greater than the rank ofsigned char[.](#1.3.sentence-1)

- [(1.4)](#1.4)

  The rank of any unsigned integer type equals the rank of the
corresponding signed integer type[.](#1.4.sentence-1)

- [(1.5)](#1.5)

  The rank of any standard integer type is greater than the
rank of any extended integer type with the same width[.](#1.5.sentence-1)

- [(1.6)](#1.6)

  The rank of char equals the rank of signed char and unsigned char[.](#1.6.sentence-1)

- [(1.7)](#1.7)

  The rank of bool is less than the rank of all
standard integer types[.](#1.7.sentence-1)

- [(1.8)](#1.8)

  The ranks of char8_t, char16_t, char32_t, andwchar_t equal the ranks of their underlying
types ([[basic.fundamental]](basic.fundamental "6.9.2 Fundamental types"))[.](#1.8.sentence-1)

- [(1.9)](#1.9)

  The rank of any extended signed integer type relative to another
extended signed integer type with the same width is implementation-defined, but still subject to the other rules for determining the integer
conversion rank[.](#1.9.sentence-1)

- [(1.10)](#1.10)

  For all integer types T1, T2, and T3, ifT1 has greater rank than T2 and T2 has greater
rank than T3, then T1 has greater rank thanT3[.](#1.10.sentence-1)

[*Note [1](#note-1)*:

The integer conversion rank is used in the definition of the integral
promotions ([[conv.prom]](conv.prom "7.3.7 Integral promotions")) and the usual arithmetic
conversions ([[expr.arith.conv]](expr.arith.conv "7.4 Usual arithmetic conversions"))[.](#1.sentence-2)

â *end note*]

[2](#2)

[#](http://github.com/Eelis/draft/tree/9adde4bc1c62ec234483e63ea3b70a59724c745a/source/basic.tex#L6160)

Every floating-point type has a [*floating-point conversion rank*](#def:conversion_rank,floating-point "6.9.6 Conversion ranks [conv.rank]") defined as follows:

- [(2.1)](#2.1)

  The rank of a floating point type T is greater than
the rank of any floating-point type
whose set of values is a proper subset of the set of values of T[.](#2.1.sentence-1)

- [(2.2)](#2.2)

  The rank of long double is greater than
the rank of double,
which is greater than the rank of float[.](#2.2.sentence-1)

- [(2.3)](#2.3)

  Two extended floating-point types with the same set of values have equal ranks[.](#2.3.sentence-1)

- [(2.4)](#2.4)

  An extended floating-point type with the same set of values as
exactly one cv-unqualified standard floating-point type
has a rank equal to the rank of that standard floating-point type[.](#2.4.sentence-1)

- [(2.5)](#2.5)

  An extended floating-point type with the same set of values as
more than one cv-unqualified standard floating-point type
has a rank equal to the rank of double[.](#2.5.sentence-1)
  [*Note [2](#note-2)*:
  The treatment of std​::​float64_t differs from
that of the analogous _Float64 in C,
for example on platforms where all oflong double,double, andstd​::​float64_t have the same set of values (see ISO/IEC 9899:2024 H.4.2)[.](#2.5.sentence-2)
 â *end note*]

[*Note [3](#note-3)*:

The conversion ranks of floating-point types T1 and T2 are unordered if the set of values of T1 is
neither a subset nor a superset of the set of values of T2[.](#2.sentence-2)

This can happen when one type has both a larger range and a lower precision
than the other[.](#2.sentence-3)

â *end note*]

[3](#3)

[#](http://github.com/Eelis/draft/tree/9adde4bc1c62ec234483e63ea3b70a59724c745a/source/basic.tex#L6200)

Floating-point types that have equal floating-point conversion ranks
are ordered by floating-point conversion subrank[.](#3.sentence-1)

The subrank forms a total order among types with equal ranks[.](#3.sentence-2)

The typesstd​::​float16_t,std​::​float32_t,std​::​float64_t, andstd​::​float128_t ([[stdfloat.syn]](stdfloat.syn "17.4.2 Header <stdfloat> synopsis"))
have a greater conversion subrank than any standard floating-point type
with equal conversion rank[.](#3.sentence-3)

Otherwise, the conversion subrank order isimplementation-defined[.](#3.sentence-4)

[4](#4)

[#](http://github.com/Eelis/draft/tree/9adde4bc1c62ec234483e63ea3b70a59724c745a/source/basic.tex#L6214)

[*Note [4](#note-4)*:

The floating-point conversion rank and subrank are used in
the definition of the usual arithmetic conversions ([[expr.arith.conv]](expr.arith.conv "7.4 Usual arithmetic conversions"))[.](#4.sentence-1)

â *end note*]
