Namespaces
Variants

std::numeric_limits<T>::lowest

cppreference.net에서 가져옴
 
 
유틸리티 라이브러리
일반 유틸리티
관계 연산자 (C++20에서 비권장됨)
정수 비교 함수
(C++20)(C++20)(C++20)    
(C++20)
Swap 및 타입 연산
(C++14)
(C++11)
(C++11)
(C++11)
(C++17)
공통 어휘 타입
(C++11)
(C++17)
(C++17)
(C++17)
(C++11)
(C++17)
(C++23)



 
 
 
static constexpr T lowest() noexcept;
(C++11 이후)

숫자 타입 T으로 표현 가능한 가장 작은 유한 값을 반환합니다. 즉, 다른 유한 값 x이 y를 만족하는 y < x가 존재하지 않는 그러한 유한 값입니다. 이는 부동소수점 타입의 경우 std::numeric_limits<T>::min()과 다릅니다. 오직 유계 타입에 대해서만 의미 있습니다.

반환값

T std:: numeric_limits < T > :: lowest ( )
/* 비특수화 */ T ( )
bool false
char CHAR_MIN
signed char SCHAR_MIN
unsigned char ​ 0 ​
wchar_t WCHAR_MIN
char8_t (C++20부터) ​ 0 ​
char16_t ​ 0 ​
char32_t ​ 0 ​
short SHRT_MIN
unsigned short ​ 0 ​
int INT_MIN
unsigned int ​ 0 ​
long LONG_MIN
unsigned long ​ 0 ​
long long LLONG_MIN
unsigned long long ​ 0 ​
float - FLT_MAX
double - DBL_MAX
long double - LDBL_MAX

참고 사항

모든 표준 C++ 부동 소수점 타입에 대해 T std:: numeric_limits < T > :: lowest ( ) == - std:: numeric_limits < T > :: max ( ) 가 성립하지만, 이는 서드파티 특수화의 경우 반드시 성립해야 하는 것은 아닙니다.

예제

부동소수점 타입에 대한 min() , max() , 그리고 lowest() 함수를 보여줍니다:

#include <iostream>
#include <limits>
#include <string_view>
template<typename T>
void print_twice(std::string_view type, T value)
{
    std::cout << '\t' << type << ": "
              << std::defaultfloat << value << " or "
              << std::hexfloat << value << '\n';
}
int main()
{
    // min()
    std::cout << "std::numeric_limits<T>::min():\n";
    print_twice("float", std::numeric_limits<float>::min());
    print_twice("double", std::numeric_limits<double>::min());
    print_twice("long double", std::numeric_limits<long double>::min());
    // lowest()
    std::cout << "std::numeric_limits<T>::lowest():\n";
    print_twice("float", std::numeric_limits<float>::lowest());
    print_twice("double", std::numeric_limits<double>::lowest());
    print_twice("long double", std::numeric_limits<long double>::lowest());
    // max()
    std::cout << "std::numeric_limits<T>::max():\n";
    print_twice("float", std::numeric_limits<float>::max());
    print_twice("double", std::numeric_limits<double>::max());
    print_twice("long double", std::numeric_limits<long double>::max());
}

출력:

std::numeric_limits<T>::min():
	float: 1.17549e-38 or 0x1p-126
	double: 2.22507e-308 or 0x1p-1022
	long double: 3.3621e-4932 or 0x8p-16385
std::numeric_limits<T>::lowest():
	float: -3.40282e+38 or -0x1.fffffep+127
	double: -1.79769e+308 or -0x1.fffffffffffffp+1023
	long double: -1.18973e+4932 or -0xf.fffffffffffffffp+16380
std::numeric_limits<T>::max():
	float: 3.40282e+38 or 0x1.fffffep+127
	double: 1.79769e+308 or 0x1.fffffffffffffp+1023
	long double: 1.18973e+4932 or 0xf.fffffffffffffffp+16380

참고 항목

[static]
주어진 비부동소수점 타입의 가장 작은 유한 값을 반환하거나, 주어진 부동소수점 타입의 가장 작은 양의 정규 값을 반환합니다
(public static member function)
[static]
주어진 부동소수점 타입의 가장 작은 양의 비정규 값을 반환합니다
(public static member function)
[static]
주어진 타입의 가장 큰 유한 값을 반환합니다
(public static member function)