1. 程式人生 > >qt ceil向上取整floor向下取整

qt ceil向上取整floor向下取整

	double a = 11.2;
	double b = 11.5;
	double c = -11.2;
	double d = -11.5;

	qDebug()<<" "<<ceil(a)<<" "<<ceil(b)<<" "<<ceil(c)<<" "<<ceil(d);
	qDebug()<<" "<<floor(a)<<" "<<floor(b)<<" "<<floor(c)<<" "<<floor(d);

輸出為:

  12  12  -11  -11

  11  11  -12  -12