Fixed width floating-point types (since C++23) (original) (raw)
If the implementation supports any of the following ISO 60559 types as an extended floating-point type, then:
- the corresponding macro is defined as 1 to indicate support,
- the corresponding floating-point literal suffix is available, and
- the corresponding type alias name is provided:
[edit] 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.
[edit] Example
#include #if STDCPP_FLOAT64_T != 1 #error "64-bit float type required" #endif int main() { std::float64_t f = 0.1f64; }
[edit] References
C++23 standard (ISO/IEC 14882:2024):
6.8.3 Optional extended floating-point types [basic.extended.fp]