Skip to content
For the complete documentation index, see llms.txt. This page is also available as Markdown.

atanh

Use the atanh() function to calculate the inverse hyperbolic tangent of a numeric value.

Syntax

atanh(<number>)

Parameters

Name
Type
Required
Description

number

integer, float

Yes

The numeric value to evaluate. The value must be within the range (-1, 1) exclusive.

Returns

Type: float

Description: The atanh() function returns the inverse hyperbolic tangent of the input value. If the input is null, exactly -1, exactly 1, or outside the range (-1, 1), the function returns null or infinity.

Usage notes

  • Input type: XQL doesn't support NaN or infinite values as input and these value types also can not be returned.

  • Valid Input Range: The input number must be strictly between -1 and 1 (exclusive). Mathematically, the inverse hyperbolic tangent is only defined for values in the open interval (-1, 1).

  • Boundary Behavior: atanh(1) returns positive infinity and atanh(-1) returns negative infinity.

  • Out of Range Behavior: If the input is outside the range (-1, 1), the function returns NaN or null.

  • Null Handling: If the input expression is null, the function returns null.

  • Symmetry: The function is odd, meaning atanh(-x) = -atanh(x).

  • Identity Value: atanh(0) always returns 0.0.

  • Common Use Cases: This function is typically used within the alter stage for statistical transformations (such as the Fisher z-transformation), data normalization, and scientific computations.

Examples

Example 1: Calculate inverse hyperbolic tangent of literal values

Goal: Calculate the inverse hyperbolic tangent for specific numeric literals to verify known mathematical results.

XQL code:

Explanation: You use atanh() on three different literal values. atanh(0) returns 0.0. atanh(0.5) returns approximately 0.5493, and atanh(-0.5) returns approximately -0.5493, demonstrating the odd symmetry of the function.

Output:

RESULT1
RESULT2
RESULT3

0.0

0.54931

-0.54931

Example 2: Calculate inverse hyperbolic tangent from a field value

Goal: Calculate the inverse hyperbolic tangent of values stored in a specific field, ensuring they are within the valid mathematical range.

XQL code:

Explanation: This query first filters the dataset to ensure duration_seconds contains only values strictly between -1 and 1, avoiding mathematically invalid inputs. It then computes the inverse hyperbolic tangent for each value using atanh() in the alter stage.

Output:

EVENT_ID
DURATION_SECONDS
ATANH_RESULT

101

0.5

0.54931

102

-0.3

-0.30952

103

0.8

1.09861

Example 3: Apply Fisher z-transformation using atanh

Goal: Apply the Fisher z-transformation to correlation coefficients using atanh(), a common statistical technique.

XQL code:

Explanation: The Fisher z-transformation is mathematically equivalent to the inverse hyperbolic tangent. This query applies atanh() to correlation-like values in duration_seconds to produce the Fisher z-score, which is useful for comparing correlation coefficients.

Output:

EVENT_ID
DURATION_SECONDS
FISHER_Z

101

0.5

0.54931

102

-0.3

-0.30952

103

0.9

1.47222

Last updated

Was this helpful?