名前空間
変種
操作

std::numeric_limits

提供: cppreference.com
< cpp‎ | types

 
 
ユーティリティライブラリ
支援を入力します (basic types, RTTI, type traits)
動的なメモリ管理
エラー処理
プログラムユーティリティ
可変個引数関数
日付と時刻
関数オブジェクト
initializer_list(C++11)
bitset
hash(C++11)
関係演算子
Original:
Relational operators
The text has been machine-translated via Google Translate.
You can help to correct and verify the translation. Click here for instructions.
rel_ops::operator!=
rel_ops::operator>
rel_ops::operator<=
rel_ops::operator>=
ペアとタプル
Original:
Pairs and tuples
The text has been machine-translated via Google Translate.
You can help to correct and verify the translation. Click here for instructions.
pair
tuple(C++11)
piecewise_construct_t(C++11)
piecewise_construct(C++11)
フォワード、スワップ、および移動
Original:
Swap, forward and move
The text has been machine-translated via Google Translate.
You can help to correct and verify the translation. Click here for instructions.
swap
forward(C++11)
move(C++11)
move_if_noexcept(C++11)
declval(C++11)
 
支援を入力します
基本的なタイプ
Original:
Basic types
The text has been machine-translated via Google Translate.
You can help to correct and verify the translation. Click here for instructions.
基本的なタイプ
固定幅の整数型 (C++11)
数値の限界
Original:
Numeric limits
The text has been machine-translated via Google Translate.
You can help to correct and verify the translation. Click here for instructions.
numeric_limits
Cの数値は、インターフェイスを制限します
実行時型情報
Original:
Runtime type information
The text has been machine-translated via Google Translate.
You can help to correct and verify the translation. Click here for instructions.
型の特徴
Original:
Type traits
The text has been machine-translated via Google Translate.
You can help to correct and verify the translation. Click here for instructions.
プライマリタイプカテゴリ
Original:
Primary type categories
The text has been machine-translated via Google Translate.
You can help to correct and verify the translation. Click here for instructions.
is_void(C++11)
is_array(C++11)
is_pointer(C++11)
is_enum(C++11)
is_union(C++11)
is_class(C++11)
is_function(C++11)
is_object(C++11)
is_scalar(C++11)
is_compound(C++11)
is_integral(C++11)
is_floating_point(C++11)
is_fundamental(C++11)
is_arithmetic(C++11)
is_reference(C++11)
is_lvalue_reference(C++11)
is_rvalue_reference(C++11)
is_member_pointer(C++11)
is_member_object_pointer(C++11)
is_member_function_pointer(C++11)
Typeプロパティ
Original:
Type properties
The text has been machine-translated via Google Translate.
You can help to correct and verify the translation. Click here for instructions.
is_const(C++11)
is_volatile(C++11)
is_pod(C++11)
is_empty(C++11)
is_polymorphic(C++11)
is_abstract(C++11)
サポートされる操作
Original:
Supported operations
The text has been machine-translated via Google Translate.
You can help to correct and verify the translation. Click here for instructions.
is_constructible
is_trivially_constructible
is_nothrow_constructible
(C++11)
(C++11)
(C++11)
is_default_constructible
is_trivially_default_constructible
is_nothrow_default_constructible
(C++11)
(C++11)
(C++11)
is_copy_constructible
is_trivially_copy_constructible
is_nothrow_copy_constructible
(C++11)
(C++11)
(C++11)
is_move_constructible
is_trivially_move_constructible
is_nothrow_move_constructible
(C++11)
(C++11)
(C++11)
is_assignable
is_trivially_assignable
is_nothrow_assignable
(C++11)
(C++11)
(C++11)
is_copy_assignable
is_trivially_copy_assignable
is_nothrow_copy_assignable
(C++11)
(C++11)
(C++11)
is_move_assignable
is_trivially_move_assignable
is_nothrow_move_assignable
(C++11)
(C++11)
(C++11)
is_destructible
is_trivially_destructible
is_nothrow_destructible
(C++11)
(C++11)
(C++11)
has_virtual_destructor(C++11)
リレーションシップとプロパティクエリ
Original:
Relationships and property queries
The text has been machine-translated via Google Translate.
You can help to correct and verify the translation. Click here for instructions.
is_same(C++11)
is_base_of(C++11)
is_convertible(C++11)
alignment_of(C++11)
rank(C++11)
extent(C++11)
型の変更
Original:
Type modifications
The text has been machine-translated via Google Translate.
You can help to correct and verify the translation. Click here for instructions.
remove_cv
remove_const
remove_volatile
(C++11)
(C++11)
(C++11)
add_cv
add_const
add_volatile
(C++11)
(C++11)
(C++11)
make_signed(C++11)
make_unsigned(C++11)
型変換
Original:
Type transformations
The text has been machine-translated via Google Translate.
You can help to correct and verify the translation. Click here for instructions.
aligned_storage(C++11)
aligned_union(C++11)
decay(C++11)
enable_if(C++11)
conditional(C++11)
common_type(C++11)
underlying_type(C++11)
result_of(C++11)
形質定数を入力します
Original:
Type trait constants
The text has been machine-translated via Google Translate.
You can help to correct and verify the translation. Click here for instructions.
integral_constant(C++11)
 
 
Defined in header <limits>
template< class T > class numeric_limits;
numeric_limitsクラステンプレートは、基本的なタイプの様々なプロパティを(intstd::numeric_limits<int>::max()あるタイプで可能な最大値など)を照会するための標準化された方法を提供しています.
Original:
The numeric_limits class template provides a standardized way to query various properties of fundamental types (e.g. the largest possible value for type int is std::numeric_limits<int>::max()).
The text has been machine-translated via Google Translate.
You can help to correct and verify the translation. Click here for instructions.
この情報はnumeric_limitsテンプレートの特殊化を介して提供されます。標準ライブラリは、すべての基本的なタイプで利用可能な特殊化を行う:
Original:
This information is provided via specializations of the numeric_limits template. The standard library makes available specializations for all fundamental types:
The text has been machine-translated via Google Translate.
You can help to correct and verify the translation. Click here for instructions.
Defined in header <limits>
template<> class numeric_limits<bool>;

template<> class numeric_limits<char>;
template<> class numeric_limits<signed char>;
template<> class numeric_limits<unsigned char>;
template<> class numeric_limits<wchar_t>;
template<> class numeric_limits<char16_t>;   // C++11 feature
template<> class numeric_limits<char32_t>;   // C++11 feature
template<> class numeric_limits<short>;
template<> class numeric_limits<unsigned short>;
template<> class numeric_limits<int>;
template<> class numeric_limits<unsigned int>;
template<> class numeric_limits<long>;
template<> class numeric_limits<unsigned long>;
template<> class numeric_limits<long long>;
template<> class numeric_limits<unsigned long long>;
template<> class numeric_limits<float>;
template<> class numeric_limits<double>;

template<> class numeric_limits<long double>;
また、専門化は、例えば、修飾されていない分業と同じ、各基本型のすべてのcv-修飾バージョンに存在std::numeric_limits<const int>std::numeric_limits<volatile int>、そしてstd::numeric_limits<const volatile int>提供とstd::numeric_limits<int>に同等です.
Original:
Additionally, a specialization exists for every cv-qualified version of each fundamental type, identical to the unqualified specialization, e.g. std::numeric_limits<const int>, std::numeric_limits<volatile int>, and std::numeric_limits<const volatile int> are provided and are equivalent to std::numeric_limits<int>.
The text has been machine-translated via Google Translate.
You can help to correct and verify the translation. Click here for instructions.
。。例えばGCCはstd::size_t図書館の専門分野を追加することがあります提供しています:そのようなstd::streamsizeまたはstd::numeric_limitsも.
Original:
The standard library types that are aliases of fundamental types (such as std::size_t or std::streamsize may also be examined with the std::numeric_limits type traits.
The text has been machine-translated via Google Translate.
You can help to correct and verify the translation. Click here for instructions.
実装は実装固有の型に対してstd::numeric_limitsの特殊化を提供することがありstd::numeric_limits<__int128>型形質と調べることができるように基本的なデータ型(の別名である標準ライブラリの種類ライブラリが提供するタイプのため、例えばOpenEXR16ビット浮動小数点型に対してstd::numeric_limits<half>を提供しています.
Original:
Implementations may provide specializations of std::numeric_limits for implementation-specific types: e.g. GCC provides std::numeric_limits<__int128>. Libraries may add specializations for library-provided types, e.g. OpenEXR provides std::numeric_limits<half> for a 16-bit floating-point type.
The text has been machine-translated via Google Translate.
You can help to correct and verify the translation. Click here for instructions.

目次

[編集] メンバー定数

std::numeric_limitsが特化されているタイプを識別します
Original:
identifies types for which std::numeric_limits is specialized
The text has been machine-translated via Google Translate.
You can help to correct and verify the translation. Click here for instructions.

(公共の静的メンバ定数) [edit]
[静的]
署名の種類を識別します
Original:
identifies signed types
The text has been machine-translated via Google Translate.
You can help to correct and verify the translation. Click here for instructions.

(公共の静的メンバ定数) [edit]
[静的]
整数型を識別します
Original:
identifies integer types
The text has been machine-translated via Google Translate.
You can help to correct and verify the translation. Click here for instructions.

(公共の静的メンバ定数) [edit]
[静的]
正確なタイプを識別します
Original:
identifies exact types
The text has been machine-translated via Google Translate.
You can help to correct and verify the translation. Click here for instructions.

(公共の静的メンバ定数) [edit]
特殊な値 "正の無限大"を表すことができます浮動小数点型を識別します
Original:
identifies floating-point types that can represent the special value "positive infinity"
The text has been machine-translated via Google Translate.
You can help to correct and verify the translation. Click here for instructions.

(公共の静的メンバ定数) [edit]
特殊な値 "静かな非数値"(NaN)を表すことができる浮動小数点型を識別します
Original:
identifies floating-point types that can represent the special value "quiet not-a-number" (NaN)
The text has been machine-translated via Google Translate.
You can help to correct and verify the translation. Click here for instructions.

(公共の静的メンバ定数) [edit]
(NaN)の "非数値を合図する"特別な値を表すことができる浮動小数点型を識別します
Original:
identifies floating-point types that can represent the special value "signaling not-a-number" (NaN)
The text has been machine-translated via Google Translate.
You can help to correct and verify the translation. Click here for instructions.

(公共の静的メンバ定数) [edit]
[静的]
浮動小数点型で使用される非正規のスタイルを識別します
Original:
identifies the denormalization style used by the floating-point type
The text has been machine-translated via Google Translate.
You can help to correct and verify the translation. Click here for instructions.

(公共の静的メンバ定数) [edit]
identifies the floating-point types that detect loss of precision as denormalization loss rather than inexact result
(公共の静的メンバ定数) [edit]
[静的]
タイプで使用される丸めスタイルを識別します
Original:
identifies the rounding style used by the type
The text has been machine-translated via Google Translate.
You can help to correct and verify the translation. Click here for instructions.

(公共の静的メンバ定数) [edit]
[静的]
IEC 559/IEEE 754浮動小数点型を識別します
Original:
identifies the IEC 559/IEEE 754 floating-point types
The text has been machine-translated via Google Translate.
You can help to correct and verify the translation. Click here for instructions.

(公共の静的メンバ定数) [edit]
[静的]
identifies types that represent a finite set of values
(公共の静的メンバ定数) [edit]
[静的]
モジュロ演算でオーバーフローを処理するタイプを識別します
Original:
identifies types that handle overflows with modulo arithmetic
The text has been machine-translated via Google Translate.
You can help to correct and verify the translation. Click here for instructions.

(公共の静的メンバ定数) [edit]
[静的]
変更せずに表現することができるradixの桁数を指定します
Original:
number of radix digits that can be represented without change
The text has been machine-translated via Google Translate.
You can help to correct and verify the translation. Click here for instructions.

(公共の静的メンバ定数) [edit]
[静的]
変更せずに表現できる小数点以下の桁数
Original:
number of decimal digits that can be represented without change
The text has been machine-translated via Google Translate.
You can help to correct and verify the translation. Click here for instructions.

(公共の静的メンバ定数) [edit]
[静的] (C++11)
この型のすべての値を区別するために必要な小数点以下の桁数
Original:
number of decimal digits necessary to differentiate all values of this type
The text has been machine-translated via Google Translate.
You can help to correct and verify the translation. Click here for instructions.

(公共の静的メンバ定数) [edit]
[静的]
基数または指定されたタイプの表現で用いられる整数ベース
Original:
the radix or integer base used by the representation of the given type
The text has been machine-translated via Google Translate.
You can help to correct and verify the translation. Click here for instructions.

(公共の静的メンバ定数) [edit]
有効な正規化された浮動小数点値である基数の最小の負のパワーよりも1
Original:
one more than the smallest negative power of the radix that is a valid normalized floating-point value
The text has been machine-translated via Google Translate.
You can help to correct and verify the translation. Click here for instructions.

(公共の静的メンバ定数) [edit]
有効な正規化された浮動小数点値である10の最小の負のパワー
Original:
the smallest negative power of ten that is a valid normalized floating-point value
The text has been machine-translated via Google Translate.
You can help to correct and verify the translation. Click here for instructions.

(公共の静的メンバ定数) [edit]
有効な有限浮動小数点値である基数の最大の整数乗よりも1
Original:
one more than the largest integer power of the radix that is a valid finite floating-point value
The text has been machine-translated via Google Translate.
You can help to correct and verify the translation. Click here for instructions.

(公共の静的メンバ定数) [edit]
有効な有限浮動小数点値である10の最大の整数乗
Original:
the largest integer power of 10 that is a valid finite floating-point value
The text has been machine-translated via Google Translate.
You can help to correct and verify the translation. Click here for instructions.

(公共の静的メンバ定数) [edit]
[静的]
算術演算をトラップすることがありますの種類を識別します
Original:
identifies types which can cause arithmetic operations to trap
The text has been machine-translated via Google Translate.
You can help to correct and verify the translation. Click here for instructions.

(公共の静的メンバ定数) [edit]
丸め前tinynessを検出する浮動小数点型を識別します
Original:
identifies floating-point types that detect tinyness before rounding
The text has been machine-translated via Google Translate.
You can help to correct and verify the translation. Click here for instructions.

(公共の静的メンバ定数) [edit]

[編集] メンバ関数

[静的]
指定された型の最小有限値を返します
Original:
returns the smallest finite value of the given type
The text has been machine-translated via Google Translate.
You can help to correct and verify the translation. Click here for instructions.

(公共の静的メンバ関数) [edit]
[静的] (C++11)
指定された型の最小有限値を返します
Original:
returns the lowest finite value of the given type
The text has been machine-translated via Google Translate.
You can help to correct and verify the translation. Click here for instructions.

(公共の静的メンバ関数) [edit]
[静的]
指定された型の最大有限値を返します
Original:
returns the largest finite value of the given type
The text has been machine-translated via Google Translate.
You can help to correct and verify the translation. Click here for instructions.

(公共の静的メンバ関数) [edit]
[静的]
1.0と指定された浮動小数点型の次に表現可能な値の差を返します
Original:
returns the difference between 1.0 and the next representable value of the given floating-point type
The text has been machine-translated via Google Translate.
You can help to correct and verify the translation. Click here for instructions.

(公共の静的メンバ関数) [edit]
[静的]
指定された浮動小数点型の最大の丸めエラーを返します
Original:
returns the maximum rounding error of the given floating-point type
The text has been machine-translated via Google Translate.
You can help to correct and verify the translation. Click here for instructions.

(公共の静的メンバ関数) [edit]
[静的]
与えられた浮動小数点型の正の無限大の値を返します
Original:
returns the positive infinity value of the given floating-point type
The text has been machine-translated via Google Translate.
You can help to correct and verify the translation. Click here for instructions.

(公共の静的メンバ関数) [edit]
[静的]
与えられた浮動小数点型の静かなNaN値を返します
Original:
returns a quiet NaN value of the given floating-point type
The text has been machine-translated via Google Translate.
You can help to correct and verify the translation. Click here for instructions.

(公共の静的メンバ関数) [edit]
与えられた浮動小数点型のシグナリングNaN値を返します
Original:
returns a signaling NaN value of the given floating-point type
The text has been machine-translated via Google Translate.
You can help to correct and verify the translation. Click here for instructions.

(公共の静的メンバ関数) [edit]
[静的]
与えられた浮動小数点型の最小の正の非正規の値を返します
Original:
returns the smallest positive subnormal value of the given floating-point type
The text has been machine-translated via Google Translate.
You can help to correct and verify the translation. Click here for instructions.

(公共の静的メンバ関数) [edit]

[編集] ヘルパークラス

浮動小数点丸めモードを示しています
Original:
indicates floating-point rounding modes
The text has been machine-translated via Google Translate.
You can help to correct and verify the translation. Click here for instructions.

(列挙) [edit]
浮動小数点の非正規化モードを示しています
Original:
indicates floating-point denormalization modes
The text has been machine-translated via Google Translate.
You can help to correct and verify the translation. Click here for instructions.

(列挙) [edit]

[編集] Cライブラリのマクロ定数との関係

Specialization Members
min() lowest()
(C++11)
max() epsilon() digits digits10 min_exponent min_exponent10 max_exponent max_exponent10 radix
numeric_limits< bool > 2
numeric_limits< char > CHAR_MIN CHAR_MIN CHAR_MAX 2
numeric_limits< signed char > SCHAR_MIN SCHAR_MIN SCHAR_MAX 2
numeric_limits< unsigned char > 0 0 UCHAR_MAX 2
numeric_limits< wchar_t > WCHAR_MIN WCHAR_MIN WCHAR_MAX 2
numeric_limits< char16_t > 0 0 UINT_LEAST16_MAX 2
numeric_limits< char32_t > 0 0 UINT_LEAST32_MAX 2
numeric_limits< short > SHRT_MIN SHRT_MIN SHRT_MAX 2
numeric_limits< signed short >
numeric_limits< unsigned short > 0 0 USHRT_MAX 2
numeric_limits< int > INT_MIN INT_MIN INT_MAX 2
numeric_limits< signed int >
numeric_limits< unsigned int > 0 0 UINT_MAX 2
numeric_limits< long > LONG_MIN LONG_MIN LONG_MAX 2
numeric_limits< signed long >
numeric_limits< unsigned long > 0 0 ULONG_MAX 2
numeric_limits< long long > LLONG_MIN LLONG_MIN LLONG_MAX 2
numeric_limits< signed long long >
numeric_limits< unsigned long long > 0 0 ULLONG_MAX 2
numeric_limits< float > FLT_MIN -FLT_MAX FLT_MAX FLT_EPSILON FLT_MANT_DIG FLT_DIG FLT_MIN_EXP FLT_MIN_10_EXP FLT_MAX_EXP FLT_MAX_10_EXP FLT_RADIX
numeric_limits< double > DBL_MIN -DBL_MAX DBL_MAX DBL_EPSILON DBL_MANT_DIG DBL_DIG DBL_MIN_EXP DBL_MIN_10_EXP DBL_MAX_EXP DBL_MAX_10_EXP FLT_RADIX
numeric_limits< long double > LDBL_MIN -LDBL_MAX LDBL_MAX LDBL_EPSILON LDBL_MANT_DIG LDBL_DIG LDBL_MIN_EXP LDBL_MIN_10_EXP LDBL_MAX_EXP LDBL_MAX_10_EXP FLT_RADIX

[編集]

#include <limits>
#include <iostream>
 
int main() 
{
    std::cout << "type\tlowest\thighest\n";
    std::cout << "int\t"
              << std::numeric_limits<int>::lowest() << '\t'
              << std::numeric_limits<int>::max() << '\n';
    std::cout << "float\t"
              << std::numeric_limits<float>::lowest() << '\t'
              << std::numeric_limits<float>::max() << '\n';
    std::cout << "double\t"
              << std::numeric_limits<double>::lowest() << '\t'
              << std::numeric_limits<double>::max() << '\n';
}

Possible output:

type    lowest         highest
int     -2147483648    2147483647
float   -3.40282e+38   3.40282e+38
double  -1.79769e+308  1.79769e+308