math.sincos() 函数
math.sincos() 返回 math.sin(x:x) 和 math.cos(x:x) 的值。
函数类型签名
(x: float) => {sin: float, cos: float}
有关更多信息,请参见 Function type signatures。
参数
x
(必填) 要操作的值。
示例
返回一个值的正弦和余弦
import "math"
math.sincos(x: 1.23)// {cos: 0.3342377271245026, sin: 0.9424888019316975}
在地图中使用 math.sincos
import "math"
import "sampledata"
sampledata.float()
|> map(
fn: (r) => {
result = math.sincos(x: r._value)
return {_time: r._time, tag: r._tag, sin: result.sin, cos: result.cos}
},
)