Movatterモバイル変換


[0]ホーム

URL:


cppreference.com
Namespaces
Variants
    Actions

      std::numeric_limits<T>::digits

      From cppreference.com
      <cpp‎ |types‎ |numeric limits
       
       
      Utilities library
       
       
      std::numeric_limits
      Static constants
      numeric_limits::digits
      Static member functions
      Helper types
       
      staticconstint digits;
      (until C++11)
      staticconstexprint digits;
      (since C++11)

      The value ofstd::numeric_limits<T>::digits is the number of digits in base-radix that can be represented by the typeT without change. For integer types, this is the number of bits not counting the sign bit and the padding bits (if any). For floating-point types, this is the digits of the mantissa (forIEC 559/IEEE 754 implementations, this is the number of digits stored for the mantissa plus one, because the mantissa has an implicit leading 1 and binary point).

      [edit]Standard specializations

      T value ofstd::numeric_limits<T>::digits
      (assuming nopadding bits)
      /* non-specialized */0
      bool1
      charCHAR_BIT-std::numeric_limits<char>::is_signed
      signedcharCHAR_BIT-1
      unsignedcharCHAR_BIT
      wchar_tCHAR_BIT* sizeof(wchar_t)

         -std::numeric_limits<wchar_t>::is_signed

      char8_t(since C++20)CHAR_BIT
      char16_t(since C++11)CHAR_BIT* sizeof(char16_t)
      char32_t(since C++11)CHAR_BIT* sizeof(char32_t)
      shortCHAR_BIT* sizeof(short)-1
      unsignedshortCHAR_BIT* sizeof(short)
      intCHAR_BIT* sizeof(int)-1
      unsignedintCHAR_BIT* sizeof(int)
      longCHAR_BIT* sizeof(long)-1
      unsignedlongCHAR_BIT* sizeof(long)
      longlong(since C++11)CHAR_BIT* sizeof(longlong)-1
      unsignedlonglong(since C++11)CHAR_BIT* sizeof(longlong)
      floatFLT_MANT_DIG
      doubleDBL_MANT_DIG
      longdoubleLDBL_MANT_DIG

      [edit]See also

      [static]
      the radix or integer base used by the representation of the given type
      (public static member constant)[edit]
      [static]
      one more than the smallest negative power of the radix that is a valid normalized floating-point value
      (public static member constant)[edit]
      [static]
      one more than the largest integer power of the radix that is a valid finite floating-point value
      (public static member constant)[edit]
      Retrieved from "https://en.cppreference.com/mwiki/index.php?title=cpp/types/numeric_limits/digits&oldid=148389"

      [8]ページ先頭

      ©2009-2025 Movatter.jp