std::numeric_limits::denorm_min

static T denorm_min();
(C++11 前)
static constexpr T denorm_min();
(C++11 起)

std::numeric_limits<T>::has_denorm != std::denorm_absent 则返回 T 类型的最小正非正规值,否则返回 std::numeric_limits<T>::min() 。仅对浮点类型有意义。

目录

返回值

T std::numeric_limits<T>::denorm_min()
/* non-specialized */ T();
bool false
char 0
signed char 0
unsigned char 0
wchar_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<float>::is_iec559 == true 则为 2-1074
long double /* implementation-defined */

异常

(无) (C++11 前)
noexcept 规定:  
noexcept
  
(C++11 起)

示例

演示 denorm_min() 的底层位结构

#include <cstdint>
#include <cstring>
#include <limits>
#include <cassert>
int main()
{
    // 最小非正规值拥有符号位 = 0 ,指数 = 0
    // 且仅有尾数的最小有效数字位为 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());
}


参阅

[静态]
返回给定类型的最小有限值
(公开静态成员函数)
[静态]
鉴别浮点类型所用的非正规风格
(公开静态成员常量)
[静态] (C++11)
返回给定类型的最低有限值
(公开静态成员函数)

版本历史

  • (当前 | 先前 2017年7月17日 (一) 08:46Fruderica讨论 | 贡献. . (2,483字节) (-541). . (撤销)
  • 当前 | 先前 2014年10月26日 (日) 18:16P12bot讨论 | 贡献 . . (3,024字节) (0). . (Fix some translations) (撤销)
  • 当前 | 先前 2013年7月2日 (二) 11:43P12bot讨论 | 贡献 . . (3,024字节) (-322). . (Use {{lc}}. Update links. Various fixes.) (撤销)
  • 当前 | 先前 2012年11月2日 (五) 15:37P12bot讨论 | 贡献 . . (3,346字节) (+345). . (r2.7.3) (机器人添加:de, en, es, fr, it, ja, pt, ru) (撤销)
  • 当前 | 先前 2012年10月27日 (六) 11:50P12讨论 | 贡献 . . (3,001字节) (0). . (1个修订: Translate from the English version) (撤销)
  • 当前 | 先前 2012年10月26日 (五) 06:00TranslationBot讨论 | 贡献. . (3,001字节) (-56). . (Translated from the English version using Google Translate) (撤销)
  • 当前 | 先前 2012年10月26日 (五) 03:34P12讨论 | 贡献 . . (3,057字节) (0). . (1个修订: Translate from the English version) (撤销)
  • 当前 | 先前) 2012年10月25日 (四) 12:00TranslationBot讨论 | 贡献. . (3,057字节) (+3,057). . (Translated from the English version using Google Translate)