> For the complete documentation index, see [llms.txt](https://cortex-docs.paloaltonetworks.com/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://cortex-docs.paloaltonetworks.com/xql-command-reference-guide/readme/functions/atanh.md).

# atanh

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

## Syntax

```sql
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**:

```sql
dataset = xdr_data
| limit 1
| alter result1 = atanh(0), result2 = atanh(0.5), result3 = atanh(-0.5)
| fields result1, result2, result3
```

**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**:

```sql
config timeframe = 1d
| dataset = sample_xql_raw
| filter duration_seconds > -1 and duration_seconds < 1
| alter atanh_result = atanh(duration_seconds)
| fields event_id, duration_seconds, atanh_result
| limit 3
```

**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**:

```sql
config timeframe = 1d
| dataset = sample_xql_raw
| filter duration_seconds > -1 and duration_seconds < 1
| alter fisher_z = atanh(duration_seconds)
| fields event_id, duration_seconds, fisher_z
| limit 3
```

**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   |

## Related articles

* **Stages**: [`alter`](https://cortex-docs.paloaltonetworks.com/xql-command-reference-guide/readme/stages/alter.md), [`filter`](https://cortex-docs.paloaltonetworks.com/xql-command-reference-guide/readme/stages/filter.md), [`fields`](https://cortex-docs.paloaltonetworks.com/xql-command-reference-guide/readme/stages/fields.md), [`limit`](https://cortex-docs.paloaltonetworks.com/xql-command-reference-guide/readme/stages/limit.md)
* **Functions**: [`tanh`](https://cortex-docs.paloaltonetworks.com/xql-command-reference-guide/readme/functions/tanh.md), [`asinh`](https://cortex-docs.paloaltonetworks.com/xql-command-reference-guide/readme/functions/asinh.md), [`acosh`](https://cortex-docs.paloaltonetworks.com/xql-command-reference-guide/readme/functions/acosh.md)


---

# Agent Instructions
This documentation is published with GitBook. GitBook is the documentation platform designed so that both humans and AI agents can read, navigate, and reason over technical content effectively. Learn more at gitbook.com.

## Querying This Documentation
If you need additional information that is not directly available in this page, you can query the documentation by asking a question.

Perform an HTTP GET request on the following URL with the `ask` and `goal` query parameters:

```
GET https://cortex-docs.paloaltonetworks.com/xql-command-reference-guide/readme/functions/atanh.md?ask=<question>&goal=<user_goal>
```

`ask` is the immediate question: it should be specific, self-contained, and written in natural language.
`goal` is what the user is ultimately trying to achieve, the reason they need the answer. Sharing it helps GitBook give you a better, more relevant answer. A goal is most helpful when it describes the outcome the user wants rather than restating the question. For example, with `ask=how do I create an API token`, a goal like `automate deployments from our CI pipeline` lets GitBook tailor the answer to that use case.

The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
