Back to Influxdb

math.acos() function

content/flux/v0/stdlib/math/acos.md

latest3.3 KB
Original Source
<!------------------------------------------------------------------------------ IMPORTANT: This page was generated from comments in the Flux source code. Any edits made directly to this page will be overwritten the next time the documentation is generated. To make updates to this documentation, update the function comments above the function definition in the Flux source code: https://github.com/influxdata/flux/blob/master/stdlib/math/math.flux#L123-L123 Contributing to Flux: https://github.com/influxdata/flux#contributing Fluxdoc syntax: https://github.com/influxdata/flux/blob/master/docs/fluxdoc.md ------------------------------------------------------------------------------->

math.acos() returns the acosine of x in radians.

Function type signature
js
(x: float) => float

{{% caption %}} For more information, see Function type signatures. {{% /caption %}}

Parameters

x

({{< req >}}) Value to operate on.

x should be greater than -1 and less than 1. Otherwise, the operation will return NaN.

Examples

Return the acosine of a value

js
import "math"

math.acos(x: 0.22)// 1.3489818562981022


Use math.acos in map

js
import "math"

data
    |> map(fn: (r) => ({r with _value: math.acos(x: r._value)}))

{{< expand-wrapper >}} {{% expand "View example input and output" %}}

Input data

_time*tag_value
2021-01-01T00:00:00Zt1-0.021800000000000003
2021-01-01T00:00:10Zt10.1092
2021-01-01T00:00:20Zt10.0735
2021-01-01T00:00:30Zt10.1753
2021-01-01T00:00:40Zt10.15230000000000002
2021-01-01T00:00:50Zt10.0443
_time*tag_value
2021-01-01T00:00:00Zt20.1985
2021-01-01T00:00:10Zt20.0497
2021-01-01T00:00:20Zt2-0.0375
2021-01-01T00:00:30Zt20.1977
2021-01-01T00:00:40Zt20.1386
2021-01-01T00:00:50Zt20.018600000000000002

Output data

_time_value*tag
2021-01-01T00:00:00Z1.592598053869604t1
2021-01-01T00:00:10Z1.461378125419181t1
2021-01-01T00:00:20Z1.4972299878346804t1
2021-01-01T00:00:30Z1.3945858483452276t1
2021-01-01T00:00:40Z1.417901321254124t1
2021-01-01T00:00:50Z1.5264818242659286t1
_time_value*tag
2021-01-01T00:00:00Z1.3709690985581462t2
2021-01-01T00:00:10Z1.5210758434398064t2
2021-01-01T00:00:20Z1.6083051214238853t2
2021-01-01T00:00:30Z1.3717852736930785t2
2021-01-01T00:00:40Z1.4317486962850596t2
2021-01-01T00:00:50Z1.5521952541518969t2

{{% /expand %}} {{< /expand-wrapper >}}