math.copysign() 函数
math.copysign() 返回一个具有大小 x 和符号 y 的值。
函数类型签名
(x: float, y: float) => float
有关更多信息,请参见 Function type signatures。
参数
x
(必填) 在操作中使用的幅度。
y
(必填) 在操作中使用的签名。
示例
返回两个列的符号
import "math"
math.copysign(x: 1.0, y: 2.0)
在map中使用math.copysign
import "math"
data
|> map(fn: (r) => ({_time: r._time, _value: math.copysign(x: r.x, y: r.y)}))