llroundf函数
概要:
#include <math.h> long long int llroundf(float x);
描述:
该函数将参数x舍入为long long int类型的最近整数值;如果参数x位于两个整数的正中间,将向远离0的方向舍入。
如果舍入得到的值超出返回类型所能表示的范围,结果是不明确的,并且可能发生域错误或者范围错误(range error)。
参数:
float x
参数为一个float类型的浮点数。
返回值:
函数返回long long int类型的舍入得到的整数值。
范例:
|
|
输出:
llroundf(2.3f) = 2
llroundf(2.7f) = 3
llroundf(2.5f) = 3
llroundf(-2.5f) = -3
相关内容:
llround | 将double类型参数舍入为最近整数值的函数。 |
llroundl | 将long double类型参数舍入为最近整数值的函数。 |