代码点读机 / C / float.h

float.h C · 头文件

C 浮点数极限头文件,提供 FLT_MAX、DBL_EPSILON 等 float、double 的极限值。

怎么用

#include <float.h>

小例子

#include <stdio.h>
#include <float.h>
int main(void) {
    printf("%e", FLT_MAX);
    return 0;
}

运行结果

输出 float 的最大值

提醒:关注浮点数精度、范围时查它;FLT 是 float,DBL 是 double,LDBL 是 long double

官方文档:https://en.cppreference.com/w/c/types/limits

在代码里遇到不认识的词?打开代码点读机,点一下就懂 → ← C全部词条