linux下ceil圆整函数的用法
在matlab中有向上圆整的函数ceil,同样在g++中也有ceil函数,通过man查询其在linux下的用法如下:
CEIL(3) Linux Programmer's Manual CEIL(3)
NAME
ceil, ceilf, ceill - ceiling function: smallest integral value not less than argument
SYNOPSIS
#include <math.h>
double ceil(double x);
float ceilf(float x);
long double ceill(long double x);
Link with -lm.
举个例子吧:
#include <stdio.h>
int main()
{int x1;
float y1=5.4;
x1=ceil(y1);
printf("x=%d",x1);
}
用法就是这么简单,大家可以实践下。
评论