Skip to main content
Use the atan function in APL to compute the arc tangent (inverse tangent) of a numeric expression. The function returns the angle, in radians, whose tangent equals the input value. Unlike asin and acos, atan accepts any real number as input. 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.

For users of other query languages

If you come from other query languages, this section explains how to adjust your existing queries to achieve the same results in APL.
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.
| eval angle = atan(normalized)
In ANSI SQL, ATAN() is a standard mathematical function with identical semantics. It accepts any real number and returns the arc tangent in radians.
SELECT ATAN(normalized) AS angle FROM logs

Usage

Syntax

atan(x)

Parameters

NameTypeRequiredDescription
xrealYesA 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)
Run in Playground Output
result
0.7854
  • 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 atan as the inverse.
  • radians: Converts degrees to radians. Use it when your angle data is in degrees.