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

FLT_MIN_EXP宏


概要:

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


描述:

FLT_MIN_EXP表示float类型浮点数的最小负指数eminFLT_RADIX(emin - 1)是一个float类型的规格化浮点数(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 
/*宏FLT_MIN_EXP范例*/

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

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


输出:

FLT_MIN_EXP = -125

The result of powf(FLT_RADIX, FLT_MIN_EXP - 1) is a normal value.

The result of powf(FLT_RADIX, FLT_MIN_EXP - 2) is not a normal value.


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