Fixed width floating-point types (since C++23) - cppreference.com
Namespaces
Variants

Fixed width floating-point types (since C++23)

From cppreference.com
 
 
Utilities library
General utilities
Relational operators (deprecated in C++20)
Integer comparison functions
(C++20)(C++20)(C++20)    
(C++20)
Swap and type operations
(C++14)
(C++11)
(C++11)
(C++11)
(C++17)
Common vocabulary types
(C++11)
(C++17)
(C++17)
(C++17)
(C++11)
(C++17)
(C++23)



 
 

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:

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

#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]

See also