std::numeric_limits
De cppreference.com
[] |
This page has been machine-translated from the English version of the wiki using Google Translate.
The translation may contain errors and awkward wording. Hover over text to see the original version. You can help to fix errors and improve the translation. For instructions click here. |
<metanoindex/>
<tbody> </tbody>| Dclar dans l'en-tte <limits>
|
||
template< class T > class numeric_limits; |
||
Le modle de classe
numeric_limits fournit un moyen standard pour rechercher des proprits diffrentes types fondamentaux (par exemple, la plus grande valeur possible pour le type int est std::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.
You can help to correct and verify the translation. Click here for instructions.
Cette information est fournie par l'intermdiaire des spcialisations du modle
<tbody>
</tbody>numeric_limits. La bibliothque standard permet spcialisations disponibles pour tous les types fondamentaux: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.
You can help to correct and verify the translation. Click here for instructions.
| Dclar dans l'en-tte <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>; |
||
En outre, une spcialisation existe pour chaque version de cv-qualifi de chaque type fondamental, identique la spcialisation sans rserve, par exemple,
std::numeric_limits<const int>, std::numeric_limits<volatile int> et std::numeric_limits<const volatile int> sont fournis et sont quivalentes 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.
You can help to correct and verify the translation. Click here for instructions.
Les types de bibliothques standards qui sont des alias des types fondamentaux (tels que std::size_t ou std::streamsize peut galement tre consult avec les caractres de 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.
You can help to correct and verify the translation. Click here for instructions.
implmentations peuvent fournir des spcialisations de std::numeric_limits de mise en uvre spcifiques aux types: par ex. GCC fournit.
std::numeric_limits<__int128> bibliothques peuvent ajouter des spcialisations pour la bibliothque fournis par types, par exemple OpenEXR dispose std::numeric_limits<half> pour un 16-bit virgule flottante de type .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.
You can help to correct and verify the translation. Click here for instructions.
Constantes membres
[ statique ]Original: static The text has been machine-translated via Google Translate. You can help to correct and verify the translation. Click here for instructions. |
identifie les types pour lesquels std::numeric_limits est spcialise 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. (constante membre statique publique) |
[ statique ]Original: static The text has been machine-translated via Google Translate. You can help to correct and verify the translation. Click here for instructions. |
identifie les types signs 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. (constante membre statique publique) |
[ statique ]Original: static The text has been machine-translated via Google Translate. You can help to correct and verify the translation. Click here for instructions. |
identifie les types entiers 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. (constante membre statique publique) |
[ statique ]Original: static The text has been machine-translated via Google Translate. You can help to correct and verify the translation. Click here for instructions. |
identifie les types exacts 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. (constante membre statique publique) |
[ statique ]Original: static The text has been machine-translated via Google Translate. You can help to correct and verify the translation. Click here for instructions. |
identifie types virgule flottante qui peuvent reprsenter la valeur spciale "infini positif" 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. (constante membre statique publique) |
[ statique ]Original: static The text has been machine-translated via Google Translate. You can help to correct and verify the translation. Click here for instructions. |
identifie types virgule flottante qui peuvent reprsenter la valeur spciale "calme pas-a-number (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. (constante membre statique publique) |
[ statique ]Original: static The text has been machine-translated via Google Translate. You can help to correct and verify the translation. Click here for instructions. |
identifie types virgule flottante qui peuvent reprsenter la valeur spciale "signalisation non-a-number (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. (constante membre statique publique) |
[ statique ]Original: static The text has been machine-translated via Google Translate. You can help to correct and verify the translation. Click here for instructions. |
identifie le style utilis par la dnormalisation du type virgule flottante 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. (constante membre statique publique) |
[ statique ]Original: static The text has been machine-translated via Google Translate. You can help to correct and verify the translation. Click here for instructions. |
identifie les types virgule flottante qui dtectent une perte de prcision que la perte de dnormalisation plutt que des rsultats inexacts Original: identifies the floating-point types that detect loss of precision as denormalization loss rather than inexact result The text has been machine-translated via Google Translate. You can help to correct and verify the translation. Click here for instructions. (constante membre statique publique) |
[ statique ]Original: static The text has been machine-translated via Google Translate. You can help to correct and verify the translation. Click here for instructions. |
identifie le type d'arrondi utilis par le type 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. (constante membre statique publique) |
[ statique ]Original: static The text has been machine-translated via Google Translate. You can help to correct and verify the translation. Click here for instructions. |
identifie les IEC 559/IEEE 754 types virgule flottante 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. (constante membre statique publique) |
[ statique ]Original: static The text has been machine-translated via Google Translate. You can help to correct and verify the translation. Click here for instructions. |
identifie des types qui reprsentent un ensemble fini de valeurs Original: identifies types that represent a finite set of values The text has been machine-translated via Google Translate. You can help to correct and verify the translation. Click here for instructions. (constante membre statique publique) |
[ statique ]Original: static The text has been machine-translated via Google Translate. You can help to correct and verify the translation. Click here for instructions. |
identifie les types qui grent les dbordements avec l'arithmtique modulo 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. (constante membre statique publique) |
[ statique ]Original: static The text has been machine-translated via Google Translate. You can help to correct and verify the translation. Click here for instructions. |
nombre de chiffres radix qui peuvent tre reprsentes sans changement 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. (constante membre statique publique) |
[ statique ]Original: static The text has been machine-translated via Google Translate. You can help to correct and verify the translation. Click here for instructions. |
nombre de chiffres dcimaux qui peuvent tre reprsentes sans changement 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. (constante membre statique publique) |
[ statique ] (C++11)Original: static The text has been machine-translated via Google Translate. You can help to correct and verify the translation. Click here for instructions. |
nombre de chiffres dcimaux ncessaires pour diffrencier les valeurs de ce type 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. (constante membre statique publique) |
[ statique ]Original: static The text has been machine-translated via Google Translate. You can help to correct and verify the translation. Click here for instructions. |
la base ou la base utilise par nombre entier de la reprsentation du type donn 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. (constante membre statique publique) |
[ statique ]Original: static The text has been machine-translated via Google Translate. You can help to correct and verify the translation. Click here for instructions. |
un de plus que la plus petite puissance ngative de la racine qui est valide normalis valeur virgule flottante 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. (constante membre statique publique) |
[ statique ]Original: static The text has been machine-translated via Google Translate. You can help to correct and verify the translation. Click here for instructions. |
la plus petite puissance ngative de dix qui est valide normalis valeur virgule flottante 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. (constante membre statique publique) |
[ statique ]Original: static The text has been machine-translated via Google Translate. You can help to correct and verify the translation. Click here for instructions. |
un de plus que la plus grande puissance entire de la racine qui est valide finie valeur virgule flottante 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. (constante membre statique publique) |
[ statique ]Original: static The text has been machine-translated via Google Translate. You can help to correct and verify the translation. Click here for instructions. |
la plus grande puissance entire de 10 qui est valide finie valeur virgule flottante 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. (constante membre statique publique) |
[ statique ]Original: static The text has been machine-translated via Google Translate. You can help to correct and verify the translation. Click here for instructions. |
identifie les types qui peuvent causer des oprations arithmtiques piger 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. (constante membre statique publique) |
[ statique ]Original: static The text has been machine-translated via Google Translate. You can help to correct and verify the translation. Click here for instructions. |
identifie types virgule flottante qui dtectent tinyness avant arrondis 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. (constante membre statique publique) |
Fonctions membres
[ statique ]Original: static The text has been machine-translated via Google Translate. You can help to correct and verify the translation. Click here for instructions. |
renvoie la plus petite valeur finie du type donn 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. (fonction membre publique statique) |
[ statique ] (C++11)Original: static The text has been machine-translated via Google Translate. You can help to correct and verify the translation. Click here for instructions. |
renvoie la plus petite valeur finie du type donn 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. (fonction membre publique statique) |
[ statique ]Original: static The text has been machine-translated via Google Translate. You can help to correct and verify the translation. Click here for instructions. |
renvoie la plus grande valeur finie du type donn 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. (fonction membre publique statique) |
[ statique ]Original: static The text has been machine-translated via Google Translate. You can help to correct and verify the translation. Click here for instructions. |
renvoie la diffrence entre 1.0 et la prochaine valeur reprsentable de la donne virgule flottante de typeOriginal: returns the difference between 1.0 and the next representable value of the given floating-point typeThe text has been machine-translated via Google Translate. You can help to correct and verify the translation. Click here for instructions. (fonction membre publique statique) |
[ statique ]Original: static The text has been machine-translated via Google Translate. You can help to correct and verify the translation. Click here for instructions. |
retourne l'erreur d'arrondi maximum de la donne virgule flottante de type 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. (fonction membre publique statique) |
[ statique ]Original: static The text has been machine-translated via Google Translate. You can help to correct and verify the translation. Click here for instructions. |
renvoie la valeur infinie positive de la donne virgule flottante de type 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. (fonction membre publique statique) |
[ statique ]Original: static The text has been machine-translated via Google Translate. You can help to correct and verify the translation. Click here for instructions. |
renvoie une valeur NaN calme de la donne virgule flottante de type 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. (fonction membre publique statique) |
[ statique ]Original: static The text has been machine-translated via Google Translate. You can help to correct and verify the translation. Click here for instructions. |
renvoie une valeur NaN de signalisation de la donne virgule flottante de type 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. (fonction membre publique statique) |
[ statique ]Original: static The text has been machine-translated via Google Translate. You can help to correct and verify the translation. Click here for instructions. |
retourne la plus petite valeur positive infrieure la normale de la donne virgule flottante de type 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. (fonction membre publique statique) |
Classes d'aide
indique modes d'arrondi en virgule flottante 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. (enum) | |
indique les modes de dnormalisation virgule flottante 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. (enum) | |
Relations avec les constantes C macro bibliothque
| 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 |
Exemple
#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';
}
Rsultat possible :
type lowest highest
int -2147483648 2147483647
float -3.40282e+38 3.40282e+38
double -1.79769e+308 1.79769e+308