Namespaces
Variants

std::numeric_limits<T>::denorm_min

cppreference.net에서
 
 
유틸리티 라이브러리
 
 
 
static T denorm_min() throw();
(C++11까지)
static constexpr T denorm_min() noexcept;
(C++11부터)

타입 에 대한 최소 양의 비정규값T을 반환하며, std::numeric_limits<T>::has_denorm != std::denorm_absent인 경우에 해당합니다. 그렇지 않으면 부동소수점 타입에 대해서는 std::numeric_limits<T>::min()을 반환하고, 다른 모든 타입에 대해서는 T()을 반환합니다. 부동소수점 타입에 대해서만 의미가 있습니다.

반환값

T std:: numeric_limits < T > :: denorm_min ( )
/* 비전문화 */ T ( )
bool false
char ​ 0 ​
signed char ​ 0 ​
unsigned char ​ 0 ​
wchar_t ​ 0 ​
char8_t (C++20 이후) ​ 0 ​
char16_t (C++11 이후) ​ 0 ​
char32_t (C++11 이후) ​ 0 ​
short ​ 0 ​
unsigned short ​ 0 ​
int ​ 0 ​
unsigned int ​ 0 ​
long ​ 0 ​
unsigned long ​ 0 ​
long long (C++11 이후) ​ 0 ​
unsigned long long 이후 (C++11 이후) ​ 0 ​
float FLT_TRUE_MIN ( 2 -149
만약
std:: numeric_limits < float > :: is_iec559 가 true 인 경우)
double DBL_TRUE_MIN ( 2 -1074
만약
std:: numeric_limits < double > :: is_iec559 가 true 인 경우)
long double LDBL_TRUE_MIN

예제

denorm_min() 의 기본 비트 구조를 보여주고 값을 출력합니다:

#include <cassert>
#include <cstdint>
#include <cstring>
#include <iostream>
#include <limits>
int main()
{
    // the smallest subnormal value has sign bit = 0, exponent = 0
    // and only the least significant bit of the fraction is 1
    std::uint32_t denorm_bits = 0x0001;
    float denorm_float;
    std::memcpy(&denorm_float, &denorm_bits, sizeof(float));
    assert(denorm_float == std::numeric_limits<float>::denorm_min());
    std::cout << "float\tmin()\t\tdenorm_min()\n";
    std::cout << "\t" << std::numeric_limits<float>::min() << '\t';
    std::cout <<         std::numeric_limits<float>::denorm_min() << '\n';
    std::cout << "double\tmin()\t\tdenorm_min()\n";
    std::cout << "\t" << std::numeric_limits<double>::min() << '\t';
    std::cout <<         std::numeric_limits<double>::denorm_min() << '\n';
}

가능한 출력:

float	min()		denorm_min()
	1.17549e-38	1.4013e-45
double	min()		denorm_min()
	2.22507e-308	4.94066e-324

참고 항목

[static]
주어진 비부동소수점 타입의 가장 작은 유한값, 또는 주어진 부동소수점 타입의 가장 작은 양의 정규값을 반환
(public static member function)
[static]
부동소수점 타입이 사용하는 비정규화 스타일을 식별
(public static member constant)
[static] (C++11)
주어진 타입의 가장 낮은 유한값을 반환, 즉 부호 있는 타입의 경우 가장 음의 값, ​ 0 ​ 부호 없는 타입의 경우 0
(public static member function)