Fixed width floating-point types (since C++23)
From cppreference.com
If the implementation supports any of the following ISO 60559 types as an extended floating-point type, then:
- the corresponding macro is defined as
1to indicate support, - the corresponding floating-point literal suffix is available, and
- the corresponding type alias name is provided:
Notes
The type std::bfloat16_t is known as Brain Floating-Point.
Unlike the fixed width integer types, which may be aliases to standard integer types, the fixed width floating-point types must be aliases to extended floating-point types (not float / double / long double), therefore not drop-in replacements for standard floating-point types.
Example
Run this code
#include <stdfloat>
#if __STDCPP_FLOAT64_T__ != 1
#error "64-bit float type required"
#endif
int main()
{
std::float64_t f = 0.1f64;
}
References
- C++23 standard (ISO/IEC 14882:2024):
- 6.8.3 Optional extended floating-point types [basic.extended.fp]
