当前位置: C语言 -- 标准库 -- <float.h> -- LDBL_MIN_EXP

LDBL_MIN_EXP宏


概要:

#define LDBL_MIN_EXP value //value值由实现定义。


描述:

LDBL_MIN_EXP表示long double类型浮点数的最小负指数eminFLT_RADIX(emin - 1)是一个long double类型的规格化浮点数(normalized floating-point number)。


范例:
1 
2 
3 
4 
5 
6 
7 
8 
9 
10 
11 
12 
13 
14 
15 
16 
17 
18 
19 
20 
21 
22 
23 
24 
25 
/*宏LDBL_MIN_EXP范例*/

#include <float.h>
#include <math.h>
#include <stdio.h>

int main(void)
{
  printf("LDBL_MIN_EXP = %d\n", LDBL_MIN_EXP);
  
  /*指数为LDBL_MIN_EXP - 1。*/
  if(isnormal(powl(FLT_RADIX, LDBL_MIN_EXP - 1)))
    puts("The result of powl(FLT_RADIX, LDBL_MIN_EXP - 1) is a normal value.");
  else
    puts("The result of powl(FLT_RADIX, LDBL_MIN_EXP - 1) is not a normal value.");
  
  /*指数为LDBL_MIN_EXP - 2。*/
  if(isnormal(powl(FLT_RADIX, LDBL_MIN_EXP - 2)))
    puts("The result of powl(FLT_RADIX, LDBL_MIN_EXP - 2) is a normal value.");
  else
    puts("The result of powl(FLT_RADIX, LDBL_MIN_EXP - 2) is not a normal value.");
  
  return 0;
}


输出:

LDBL_MIN_EXP = -16381

The result of powl(FLT_RADIX, LDBL_MIN_EXP - 1) is a normal value.

The result of powl(FLT_RADIX, LDBL_MIN_EXP - 2) is not a normal value.


相关内容:
FLT_MIN_EXP 表示float类型浮点数的最小负指数的宏。
DBL_MIN_EXP 表示double类型浮点数的最小负指数的宏。