首页 > 文档 > round() 四舍五入
2017
07-18

round() 四舍五入

名称:round()

 

例子:

float x = 9.2;  
int rx = round(x);  // Sets 'rx' to 9

float y = 9.5;
int ry = round(y);  // Sets 'ry' to 10

float z = 9.9;
int rz = round(z);  // Sets 'rz' to 10

描述:

计算最接近参数n的整数。 例如,round(133.8)返回值134。

 

语法:

round(n)

 

参数:

n float: number to round          需要四舍五入的数

 

返回: int

 

相关:

floor()
ceil()



最后编辑:
作者:Hewes
这个作者貌似有点懒,什么都没有留下。

round() 四舍五入》有 1 条评论

  1. Pingback 引用通告: floor() 去位取整 | Processing编程艺术

留下一个回复

你的email不会被公开。