Udostępnij za pośrednictwem


numeric_limits::max

Zwraca maksymalną wartość skończonej dla określonego typu.

static Type max( ) throw( );

Wartość zwracana

Maksymalna wartość skończonej dla określonego typu.

Uwagi

Maksymalna wartość ograniczone jest INT_MAX dla typu int i FLT_MAX dla typu float.Wartość zwracana ma znaczenie jeśli is_bounded jest true.

Przykład

// 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;
}

Dane wyjściowe

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

Wymagania

Nagłówek:<limity>

Przestrzeń nazw: std

Zobacz też

Informacje

strstreambuf — Klasa