math.trunc() 函数
math.trunc() 返回 x 的整数值。
函数类型签名
(x: float) => float
有关更多信息,请参见 Function type signatures。
参数
x
(必填) 要操作的值。
示例
在小数处截断一个值
import "math"
math.trunc(x: 3.14)// 3.0
在map中使用math.trunc
import "math"
import "sampledata"
sampledata.float()
|> map(fn: (r) => ({r with _value: math.trunc(x: r._value)}))