Movatterモバイル変換


[0]ホーム

URL:


cppreference.com
Namespaces
Variants
    Actions

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

      From cppreference.com
      <cpp‎ |types
       
       
      Utilities library
       
      Type support
      Basic types
      Fixed width integer types(C++11)
      Fixed width floating-point types(C++23)
      (C++11)    
      (C++17)
      Numeric limits
      C numeric limits interface
      Runtime type information
       

      If the implementation supports any of the followingISO 60559 types as an extended floating-point type, then:

      • the corresponding macro is defined as1 to indicate support,
      • the correspondingfloating-point literal suffix is available, and
      • the corresponding type alias name is provided:
      Types
      Defined in header
      <stdfloat>
      Literal suffixPredefined macroC language typeType properties
      bits of storagebits of precisionbits of exponentmax exponent
      float16_tf16 orF16__STDCPP_FLOAT16_T___Float161611515
      float32_tf32 orF32__STDCPP_FLOAT32_T___Float3232248127
      float64_tf64 orF64__STDCPP_FLOAT64_T___Float646453111023
      float128_tf128 orF128__STDCPP_FLOAT128_T___Float1281281131516383
      bfloat16_tbf16 orBF16__STDCPP_BFLOAT16_T__(N/A)1688127

      Contents

      [edit]Notes

      The typestd::bfloat16_t is known asBrain Floating-Point.

      Unlike thefixed width integer types, which may be aliases tostandard integer types, the fixed width floating-point types must be aliases to extended floating-point types (notfloat /double /longdouble), therefore not drop-in replacements for standard floating-point types.

      [edit]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;}

      [edit]References

      • C++23 standard (ISO/IEC 14882:2024):
      • 6.8.3 Optional extended floating-point types [basic.extended.fp]

      [edit]See also

      Retrieved from "https://en.cppreference.com/mwiki/index.php?title=cpp/types/floating-point&oldid=180650"

      [8]ページ先頭

      ©2009-2025 Movatter.jp