std::numeric_limits<T>::denorm_min
提供: cppreference.com
<tbody>
</tbody>
<tbody class="t-dcl-rev ">
</tbody><tbody>
</tbody>
static T denorm_min() throw(); |
(C++11未満) | |
static constexpr T denorm_min() noexcept; |
(C++11以上) | |
std::numeric_limits<T>::has_denorm != std::denorm_absent の場合は、型 T の最も小さな正の非正規化数を返し、そうでなければ std::numeric_limits<T>::min() を返します。 浮動小数点型に対してのみ意味があります。
戻り値
T
|
std::numeric_limits<T>::denorm_min()
|
| /* 非特殊化 */ | T()
|
bool
|
false
|
char
|
0
|
signed char
|
0
|
unsigned char
|
0
|
wchar_t
|
0
|
char8_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
|
std::numeric_limits<float>::is_iec559 == true の場合は 2-149 |
double
|
std::numeric_limits<double>::is_iec559 == true の場合は 2-1074 |
long double
|
処理系定義 |
例
denorm_min() のビット構造をデモンストレーションし、その値を表示します。
Run this code
#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
関連項目
[静的] |
指定された型の最も小さな有限の値を返します (パブリック静的メンバ関数) |
[静的] |
浮動小数点型によって使用される非正規化形式を識別します (パブリック静的メンバ定数) |
[静的] (C++11) |
指定された型の最も低い有限の値を返します (パブリック静的メンバ関数) |