相关疑难解决方法(0)

漂浮小于FLT_MIN.为什么FLT_TRUE_MIN?

试图看看在浮动下溢的情况下会发生什么,我发现我可以使浮点数比FLT_MIN小得多.我在OS 10.9上使用xcode 5.1.语言方言是gnu99.

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

int main(int argc, const char * argv[])
{
    float underflow = FLT_MIN * 0.0000004;

    printf("Float min is %f or %e.\nUnderflow is %f or %e\nMin float exp is %d.\n", FLT_MIN, FLT_MIN, underflow, underflow, FLT_MIN_10_EXP);

    return 0;
}
Run Code Online (Sandbox Code Playgroud)

打印:
Float min为0.000000或1.175494e-38.
下溢为0.000000或4.203895e-45
Min float exp为-37.

  1. 是否有更有效的方法来证明数据类型的限制?
  2. 为什么FLT_MIN实际上不是最小的浮点值?我应该使用其他常量吗?输入上一个问题后,我找到了FLT_TRUE_MIN.这个号码是多少?

c floating-point gnu99

6
推荐指数
2
解决办法
1986
查看次数

标签 统计

c ×1

floating-point ×1

gnu99 ×1