Freigeben über


numeric_limits::max

Gibt den maximalen begrenzten Wert für einen Typ zurück.

static Type max( ) throw( );

Rückgabewert

Der maximale gebundener Wert für einen Typ.

Hinweise

Der maximale gebundener Wert ist INT_MAX für Typ int und FLT_MAX für Typ float. Der Rückgabewert ist sinnvoll, wenn is_boundedtrue ist.

Beispiel

// numeric_limits_max.cpp
// compile with: /EHsc
#include <iostream>
#include <limits>

using namespace std;

int main() {
   cout << "The maximum value for type float is:  "
        << numeric_limits<float>::max( )
        << endl;
   cout << "The maximum value for type double is:  "
        << numeric_limits<double>::max( )
        << endl;
   cout << "The maximum value for type int is:  "
        << numeric_limits<int>::max( )
        << endl;
   cout << "The maximum value for type short int is:  "
        << numeric_limits<short int>::max( )
        << endl;
}

Ausgabe

The maximum value for type float is:  3.40282e+038
The maximum value for type double is:  1.79769e+308
The maximum value for type int is:  2147483647
The maximum value for type short int is:  32767

Anforderungen

Grenzen Header: <>

Namespace: std

Siehe auch

Referenz

strstreambuf-Klasse