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

LDBL_MIN_10_EXP宏


概要:

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


描述:

LDBL_MIN_10_EXP表示基数为10long double类型浮点数的最小负指数, l o g 10 b e min - 1 10LDBL_MIN_10_EXPlong double类型规格化浮点数(normalized floating-point numbers)范围内。

LDBL_MIN_10_EXP最大值为-37,具体值由实现定义。


范例:
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 
26 
/*宏LDBL_MIN_10_EXP范例*/

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

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


输出:

LDBL_MIN_10_EXP = -4931

LDBL_MIN_10_EXP = -4931

The result of powl(10, LDBL_MIN_10_EXP) is a normal value.

The result of powl(10, LDBL_MIN_10_EXP - 1) is not a normal value.


相关内容:
FLT_MIN_10_EXP 表示基数为10float类型浮点数最小负指数的宏。
DBL_MIN_10_EXP 表示基数为10double类型浮点数最小负指数的宏。