atan
atan is useful when you want to map a numeric value from an unbounded range to a bounded angular range (-π/2, π/2). For example, you can use atan to normalize latency deviations, scores, or ratios into a smooth angle scale for comparison or encoding.
Usage#
Syntax#
atan(x)Parameters#
| Name | Type | Required | Description |
|---|---|---|---|
x |
real | Yes | A real number. |
Returns#
The arc tangent of x in radians, in the range (-π/2, π/2).
Example#
Use atan to compute the arctangent of a value and return the angle in radians.
Query
print result = atan(1)Output
| result |
|---|
| 0.7854 |
List of related functions#
- atan2: Returns the arc tangent using two arguments (y, x). Use it when you have separate numerator and denominator values.
- asin: Returns the arc sine. Use it when the input is bounded to [-1, 1].
- acos: Returns the arc cosine. Use it when you need the inverse cosine instead.
- tan: Returns the tangent. Use it to apply the forward transformation before using
atanas the inverse. - radians: Converts degrees to radians. Use it when your angle data is in degrees.
Other query languages#
Splunk SPL users
In Splunk SPL, atan() is available in the eval command with the same behavior: it returns the arc tangent in radians for any real number input.
Splunk example
| eval angle = atan(normalized)APL equivalent
['sample-http-logs']
| extend angle = atan(normalized)ANSI SQL users
In ANSI SQL, ATAN() is a standard mathematical function with identical semantics. It accepts any real number and returns the arc tangent in radians.
SQL example
SELECT ATAN(normalized) AS angle FROM logsAPL equivalent
['sample-http-logs']
| extend angle = atan(normalized)