math.round() 函数
math.round() 返回最接近的整数,向远离零的方向舍入一半。
函数类型签名
(x: float) => float
有关更多信息,请参见 Function type signatures。
参数
x
(必填) 要操作的值。
示例
将值四舍五入到最接近的整数
import "math"
math.round(x: 2.12)// 2.0
在map中使用math.round
import "math"
import "sampledata"
sampledata.float()
|> map(fn: (r) => ({r with _value: math.round(x: r._value)}))