创客百科

姿势共享,有节操无门槛参与的创客百科,创客动力之源 \ (^_^) /

用户工具

站点工具


arduino:language:round

round()

例子

float x = 8.22;  
int rx = round(x); // Sets rx to 8
 
float y = 9.9;
int ry = round(y); // Sets ry to 10 
 
float z = -10.6;
int rz = round(z); // Sets rz to -11

描述

计算接近于给定参数的整数值。

语言

round(value)

参数

value float

返回 int

本页面的其他翻译:
arduino/language/round.txt · 最后更改: 2016/12/25 22:15 (外部编辑)