std::numeric_limits::infinity - cppreference.com
Da cppreference.com.
|
|
Questa pagina è stata tradotta in modo automatico dalla versione in ineglese della wiki usando Google Translate. La traduzione potrebbe contenere errori e termini strani. Muovi il puntatore sopra al testo per vedere la versione originale. Puoi aiutarci a correggere gli gli errori. Per ulteriori istruzioni clicca qui. |
<metanoindex/>
<tbody> </tbody>
|
|
(fino al c++11) | |
|
|
(dal C++11) | |
Restituisce il valore speciale "infinito positivo", come rappresentato dalla virgola mobile T tipo. Ha senso solo se std::numeric_limits<T>::has_infinity == true. In IEEE 754, la rappresentazione binaria più comune di numeri a virgola mobile, l'infinito positivo è il valore di tutti i bit del set esponente e tutti i bit della frazione cancellato.
Original:
Returns the special value "positive infinity", as represented by the floating-point type T. Only meaningful if std::numeric_limits<T>::has_infinity == true. In IEEE 754, the most common binary representation of floating-point numbers, the positive infinity is the value with all bits of the exponent set and all bits of the fraction cleared.
The text has been machine-translated via Google Translate.
You can help to correct and verify the translation. Click here for instructions.
Valore di ritorno
T
|
std::numeric_limits<T>::infinity()
|
| /* non-specialized */ | T();
|
bool
|
false
|
char
|
0
|
signed char
|
0
|
unsigned char
|
0
|
wchar_t
|
0
|
char16_t
|
0
|
char32_t
|
0
|
short
|
0
|
unsigned short
|
0
|
int
|
0
|
unsigned int
|
0
|
long
|
0
|
unsigned long
|
0
|
long long
|
0
|
unsigned long long
|
0
|
float
|
HUGE_VALF |
double
|
HUGE_VAL |
long double
|
HUGE_VALL |
Eccezioni
Esempio
#include <iostream> #include <limits> int main() { double max = std::numeric_limits<double>::max(); double inf = std::numeric_limits<double>::infinity(); if(inf > max) std::cout << inf << " is greater than " << max << '\n'; }
Output:
inf is greater than 1.79769e+308
Vedi anche
identifica i tipi a virgola mobile che possono rappresentare la speciale "positive infinity" valore Original: identifies floating-point types that can represent the special value "positive infinity" The text has been machine-translated via Google Translate. (pubblico membro statico costante) [modifica] | |