相关疑难解决方法(0)

round()for C++中的float

我需要一个简单的浮点舍入函数,因此:

double round(double);

round(0.1) = 0
round(-0.1) = 0
round(-0.9) = -1
Run Code Online (Sandbox Code Playgroud)

我能找到ceil()floor()在math.h中-但不是round().

它是以另一个名称存在于标准C++库中,还是缺少?

c++ floating-point rounding

227
推荐指数
11
解决办法
36万
查看次数

标签 统计

c++ ×1

floating-point ×1

rounding ×1