四舍五入
Math.round(value: number): integer
把浮点数四舍五入为整数。
参数1 项
| 序号 | 名称 | 类型 | 参数说明 |
|---|---|---|---|
| 1 | value | 浮 | 要处理的数字,例如 3.6。 |
返回值至少接收一个返回值
| 序号 | 名称 | 类型 | 返回说明 |
|---|---|---|---|
| 1 | number | 整 | 四舍五入后的整数。
|
数学函数
Math.round(value: number): integer
把浮点数四舍五入为整数。
| 序号 | 名称 | 类型 | 参数说明 |
|---|---|---|---|
| 1 | value | 浮 | 要处理的数字,例如 3.6。 |
| 序号 | 名称 | 类型 | 返回说明 |
|---|---|---|---|
| 1 | number | 整 | 四舍五入后的整数。
|
Math.clamp(value: number, min: number, max: number): number
把数字限制在指定的最小值和最大值之间。
| 序号 | 名称 | 类型 | 参数说明 |
|---|---|---|---|
| 1 | value | 浮 | 要限制的数字。 |
| 2 | min | 浮 | 允许的最小值。 |
| 3 | max | 浮 | 允许的最大值。 |
| 序号 | 名称 | 类型 | 返回说明 |
|---|---|---|---|
| 1 | number | 浮 | 限制后的数字。
|
Math.inRange(value: number, min: number, max: number): integer
判断数字是否位于指定范围内。
| 序号 | 名称 | 类型 | 参数说明 |
|---|---|---|---|
| 1 | value | 浮 | 要判断的数字。 |
| 2 | min | 浮 | 范围最小值。 |
| 3 | max | 浮 | 范围最大值。 |
| 序号 | 名称 | 类型 | 返回说明 |
|---|---|---|---|
| 1 | inRange | 整 | 数字是否在范围内。
|