> For the complete documentation index, see [llms.txt](https://docs.redivis.com/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://docs.redivis.com/reference/workflows/transforms/variable-creation-methods/math.md).

# Math

### Absolute value

Returns the absolute value of a variable –> [learn more](https://cloud.google.com/bigquery/docs/reference/standard-sql/functions-and-operators#abs)

```sql
ABS(@variable)
```

#### Return type

dynamic (input-dependent)

#### Parameters

| Name        | Type                                                                                                                       | Allowed values                                                                                                                                     | Required | Placeholder (in UI) |
| ----------- | -------------------------------------------------------------------------------------------------------------------------- | -------------------------------------------------------------------------------------------------------------------------------------------------- | -------- | ------------------- |
| `@variable` | [variable](https://docs.redivis.com/reference/projects/transform-nodes/variable-creation-methods/common-elements#variable) | any [integer](https://docs.redivis.com/reference/datasets/variables#integer), [float](https://docs.redivis.com/reference/datasets/variables#float) | true     | -                   |

### Arithmetic

Compute simple arithmetic (+, -, \*, /) –> [learn more](https://cloud.google.com/bigquery/docs/reference/standard-sql/functions-and-operators#arithmetic)

```sql
(@expression @operator @expression_2)
```

#### Return type

dynamic (input-dependent)

#### Parameters

| Name            | Type                                                                                                                                                                                                                                                   | Allowed values                                                                                                                                     | Required | Placeholder (in UI) |
| --------------- | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------ | -------------------------------------------------------------------------------------------------------------------------------------------------- | -------- | ------------------- |
| `@expression`   | [variable](https://docs.redivis.com/reference/projects/transform-nodes/variable-creation-methods/common-elements#variable) or [literal](https://docs.redivis.com/reference/projects/transform-nodes/variable-creation-methods/common-elements#literal) | any [integer](https://docs.redivis.com/reference/datasets/variables#integer), [float](https://docs.redivis.com/reference/datasets/variables#float) | true     | -                   |
| `@operator`     | [enum](https://docs.redivis.com/reference/projects/transform-nodes/variable-creation-methods/common-elements#enum)                                                                                                                                     | any of: `+`, `-`, `*`, `/`                                                                                                                         | true     | *(E.g., +)*         |
| `@expression_2` | [variable](https://docs.redivis.com/reference/projects/transform-nodes/variable-creation-methods/common-elements#variable) or [literal](https://docs.redivis.com/reference/projects/transform-nodes/variable-creation-methods/common-elements#literal) | any [integer](https://docs.redivis.com/reference/datasets/variables#integer), [float](https://docs.redivis.com/reference/datasets/variables#float) | true     | -                   |

### Ceiling

Returns the smallest integral value that is not less than the provided value –> [learn more](https://cloud.google.com/bigquery/docs/reference/standard-sql/functions-and-operators#ceiling)

```sql
CEILING(@variable)
```

#### Return type

float

#### Parameters

| Name        | Type                                                                                                                       | Allowed values                                                           | Required | Placeholder (in UI) |
| ----------- | -------------------------------------------------------------------------------------------------------------------------- | ------------------------------------------------------------------------ | -------- | ------------------- |
| `@variable` | [variable](https://docs.redivis.com/reference/projects/transform-nodes/variable-creation-methods/common-elements#variable) | any [float](https://docs.redivis.com/reference/datasets/variables#float) | true     | -                   |

### Integer divide

Divide two integer values, rounding down any remainder –> [learn more](https://cloud.google.com/bigquery/docs/reference/standard-sql/functions-and-operators#div)

```sql
DIV(@expression, @expression_2)
```

#### Return type

integer

#### Parameters

| Name            | Type                                                                                                                                                                                                                                                   | Allowed values                                                               | Required | Placeholder (in UI) |
| --------------- | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------ | ---------------------------------------------------------------------------- | -------- | ------------------- |
| `@expression`   | [variable](https://docs.redivis.com/reference/projects/transform-nodes/variable-creation-methods/common-elements#variable) or [literal](https://docs.redivis.com/reference/projects/transform-nodes/variable-creation-methods/common-elements#literal) | any [integer](https://docs.redivis.com/reference/datasets/variables#integer) | true     | -                   |
| `@expression_2` | [variable](https://docs.redivis.com/reference/projects/transform-nodes/variable-creation-methods/common-elements#variable) or [literal](https://docs.redivis.com/reference/projects/transform-nodes/variable-creation-methods/common-elements#literal) | any [integer](https://docs.redivis.com/reference/datasets/variables#integer) | true     | -                   |

### e ^ x

Compute the natural exponential of a value –> [learn more](https://cloud.google.com/bigquery/docs/reference/standard-sql/functions-and-operators#exp)

```sql
EXP(@expression)
```

#### Return type

float

#### Parameters

| Name          | Type                                                                                                                                                                                                                                                   | Allowed values                                                                                                                                     | Required | Placeholder (in UI) |
| ------------- | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------ | -------------------------------------------------------------------------------------------------------------------------------------------------- | -------- | ------------------- |
| `@expression` | [variable](https://docs.redivis.com/reference/projects/transform-nodes/variable-creation-methods/common-elements#variable) or [literal](https://docs.redivis.com/reference/projects/transform-nodes/variable-creation-methods/common-elements#literal) | any [integer](https://docs.redivis.com/reference/datasets/variables#integer), [float](https://docs.redivis.com/reference/datasets/variables#float) | true     | -                   |

### Floor

Returns the largest integral value that is not greater than the provided value –> [learn more](https://cloud.google.com/bigquery/docs/reference/standard-sql/functions-and-operators#floor)

```sql
FLOOR(@variable)
```

#### Return type

float

#### Parameters

| Name        | Type                                                                                                                       | Allowed values                                                           | Required | Placeholder (in UI) |
| ----------- | -------------------------------------------------------------------------------------------------------------------------- | ------------------------------------------------------------------------ | -------- | ------------------- |
| `@variable` | [variable](https://docs.redivis.com/reference/projects/transform-nodes/variable-creation-methods/common-elements#variable) | any [float](https://docs.redivis.com/reference/datasets/variables#float) | true     | -                   |

### Greatest

Find the largest of several values –> [learn more](https://cloud.google.com/bigquery/docs/reference/standard-sql/functions-and-operators#greatest)

```sql
GREATEST(@expression)
```

#### Return type

dynamic (input-dependent)

#### Parameters

| Name          | Type                                                                                                                                                                                                                                                     | Allowed values                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                           | Required | Placeholder (in UI) |
| ------------- | -------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------ | -------- | ------------------- |
| `@expression` | [variable](https://docs.redivis.com/reference/projects/transform-nodes/variable-creation-methods/common-elements#variable)s or [literal](https://docs.redivis.com/reference/projects/transform-nodes/variable-creation-methods/common-elements#literal)s | any [integer](https://docs.redivis.com/reference/datasets/variables#integer), [float](https://docs.redivis.com/reference/datasets/variables#float), [date](https://docs.redivis.com/reference/datasets/variables#date), [dateTime](https://docs.redivis.com/reference/datasets/variables#dateTime), [time](https://docs.redivis.com/reference/datasets/variables#time), [string](https://docs.redivis.com/reference/datasets/variables#string), [boolean](https://docs.redivis.com/reference/datasets/variables#boolean) | true     | -                   |

### Is infinity

Return true if the value is positive or negative infinity, false otherwise. Returns NULL for NULL inputs –> [learn more](https://cloud.google.com/bigquery/docs/reference/standard-sql/functions-and-operators#is_inf)

```sql
IS_INF(@variable)
```

#### Return type

boolean

#### Parameters

| Name        | Type                                                                                                                       | Allowed values                                                                                                                                     | Required | Placeholder (in UI) |
| ----------- | -------------------------------------------------------------------------------------------------------------------------- | -------------------------------------------------------------------------------------------------------------------------------------------------- | -------- | ------------------- |
| `@variable` | [variable](https://docs.redivis.com/reference/projects/transform-nodes/variable-creation-methods/common-elements#variable) | any [integer](https://docs.redivis.com/reference/datasets/variables#integer), [float](https://docs.redivis.com/reference/datasets/variables#float) | true     | -                   |

### Is NaN

Determines whether input value is not a number (NaN) –> [learn more](https://cloud.google.com/bigquery/docs/reference/standard-sql/functions-and-operators#is_nan)

```sql
IS_NAN(@variable)
```

#### Return type

boolean

#### Parameters

| Name        | Type                                                                                                                       | Allowed values                                                                                                                                     | Required | Placeholder (in UI) |
| ----------- | -------------------------------------------------------------------------------------------------------------------------- | -------------------------------------------------------------------------------------------------------------------------------------------------- | -------- | ------------------- |
| `@variable` | [variable](https://docs.redivis.com/reference/projects/transform-nodes/variable-creation-methods/common-elements#variable) | any [integer](https://docs.redivis.com/reference/datasets/variables#integer), [float](https://docs.redivis.com/reference/datasets/variables#float) | true     | -                   |

### Least

Find the smallest of several values –> [learn more](https://cloud.google.com/bigquery/docs/reference/standard-sql/functions-and-operators#least)

```sql
LEAST(@expression)
```

#### Return type

dynamic (input-dependent)

#### Parameters

| Name          | Type                                                                                                                                                                                                                                                     | Allowed values                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                           | Required | Placeholder (in UI) |
| ------------- | -------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------ | -------- | ------------------- |
| `@expression` | [variable](https://docs.redivis.com/reference/projects/transform-nodes/variable-creation-methods/common-elements#variable)s or [literal](https://docs.redivis.com/reference/projects/transform-nodes/variable-creation-methods/common-elements#literal)s | any [integer](https://docs.redivis.com/reference/datasets/variables#integer), [float](https://docs.redivis.com/reference/datasets/variables#float), [date](https://docs.redivis.com/reference/datasets/variables#date), [dateTime](https://docs.redivis.com/reference/datasets/variables#dateTime), [time](https://docs.redivis.com/reference/datasets/variables#time), [string](https://docs.redivis.com/reference/datasets/variables#string), [boolean](https://docs.redivis.com/reference/datasets/variables#boolean) | true     | -                   |

### Log

Compute the logarithm of a value to a provided base; generates an error if the variable is <= 0. If no base is provided, defaults to natural log –> [learn more](https://cloud.google.com/bigquery/docs/reference/standard-sql/functions-and-operators#log)

```sql
LOG(@expression[, @literal])
```

#### Return type

float

#### Parameters

| Name          | Type                                                                                                                                                                                                                                                   | Allowed values                                                                                                                                     | Required | Placeholder (in UI) |
| ------------- | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------ | -------------------------------------------------------------------------------------------------------------------------------------------------- | -------- | ------------------- |
| `@expression` | [variable](https://docs.redivis.com/reference/projects/transform-nodes/variable-creation-methods/common-elements#variable) or [literal](https://docs.redivis.com/reference/projects/transform-nodes/variable-creation-methods/common-elements#literal) | any [integer](https://docs.redivis.com/reference/datasets/variables#integer), [float](https://docs.redivis.com/reference/datasets/variables#float) | true     | -                   |
| `@literal`    | [literal](https://docs.redivis.com/reference/projects/transform-nodes/variable-creation-methods/common-elements#literal)                                                                                                                               | any [integer](https://docs.redivis.com/reference/datasets/variables#integer), [float](https://docs.redivis.com/reference/datasets/variables#float) | false    | -                   |

### Mod

Modulo: compute the remainder of the division of two integers –> [learn more](https://cloud.google.com/bigquery/docs/reference/standard-sql/functions-and-operators#mod)

```sql
MOD(@expression, @expression_2)
```

#### Return type

integer

#### Parameters

| Name            | Type                                                                                                                                                                                                                                                   | Allowed values                                                               | Required | Placeholder (in UI) |
| --------------- | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------ | ---------------------------------------------------------------------------- | -------- | ------------------- |
| `@expression`   | [variable](https://docs.redivis.com/reference/projects/transform-nodes/variable-creation-methods/common-elements#variable) or [literal](https://docs.redivis.com/reference/projects/transform-nodes/variable-creation-methods/common-elements#literal) | any [integer](https://docs.redivis.com/reference/datasets/variables#integer) | true     | -                   |
| `@expression_2` | [variable](https://docs.redivis.com/reference/projects/transform-nodes/variable-creation-methods/common-elements#variable) or [literal](https://docs.redivis.com/reference/projects/transform-nodes/variable-creation-methods/common-elements#literal) | any [integer](https://docs.redivis.com/reference/datasets/variables#integer) | true     | -                   |

### Power

Raises a value to a power –> [learn more](https://cloud.google.com/bigquery/docs/reference/standard-sql/functions-and-operators#pow)

```sql
POW(@expression, @expression_2)
```

#### Return type

float

#### Parameters

| Name            | Type                                                                                                                                                                                                                                                   | Allowed values                                                                                                                                     | Required | Placeholder (in UI) |
| --------------- | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------ | -------------------------------------------------------------------------------------------------------------------------------------------------- | -------- | ------------------- |
| `@expression`   | [variable](https://docs.redivis.com/reference/projects/transform-nodes/variable-creation-methods/common-elements#variable) or [literal](https://docs.redivis.com/reference/projects/transform-nodes/variable-creation-methods/common-elements#literal) | any [integer](https://docs.redivis.com/reference/datasets/variables#integer), [float](https://docs.redivis.com/reference/datasets/variables#float) | true     | -                   |
| `@expression_2` | [variable](https://docs.redivis.com/reference/projects/transform-nodes/variable-creation-methods/common-elements#variable) or [literal](https://docs.redivis.com/reference/projects/transform-nodes/variable-creation-methods/common-elements#literal) | any [integer](https://docs.redivis.com/reference/datasets/variables#integer), [float](https://docs.redivis.com/reference/datasets/variables#float) | true     | -                   |

### Random

Generate a pseudo-random float between \[0, 1) –> [learn more](https://cloud.google.com/bigquery/docs/reference/standard-sql/functions-and-operators#rand)

```sql
RAND()
```

#### Return type

float

#### Parameters

### Round

Rounds a value to the nearest integer (or, if specified, to the provided number of decimal places) –> [learn more](https://cloud.google.com/bigquery/docs/reference/standard-sql/functions-and-operators#round)

```sql
ROUND(@expression[, @literal])
```

#### Return type

float

#### Parameters

| Name          | Type                                                                                                                                                                                                                                                   | Allowed values                                                                                                                                     | Required | Placeholder (in UI) |
| ------------- | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------ | -------------------------------------------------------------------------------------------------------------------------------------------------- | -------- | ------------------- |
| `@expression` | [variable](https://docs.redivis.com/reference/projects/transform-nodes/variable-creation-methods/common-elements#variable) or [literal](https://docs.redivis.com/reference/projects/transform-nodes/variable-creation-methods/common-elements#literal) | any [integer](https://docs.redivis.com/reference/datasets/variables#integer), [float](https://docs.redivis.com/reference/datasets/variables#float) | true     | -                   |
| `@literal`    | [literal](https://docs.redivis.com/reference/projects/transform-nodes/variable-creation-methods/common-elements#literal)                                                                                                                               | any [integer](https://docs.redivis.com/reference/datasets/variables#integer)                                                                       | false    | -                   |

### Safe divide

Equivalent to the divisor operator, but returns null if an error occurs, such as a division by zero error –> [learn more](https://cloud.google.com/bigquery/docs/reference/standard-sql/functions-and-operators#safe_divide)

```sql
SAFE_DIVIDE(@expression, @expression_2)
```

#### Return type

float

#### Parameters

| Name            | Type                                                                                                                                                                                                                                                   | Allowed values                                                                                                                                     | Required | Placeholder (in UI) |
| --------------- | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------ | -------------------------------------------------------------------------------------------------------------------------------------------------- | -------- | ------------------- |
| `@expression`   | [variable](https://docs.redivis.com/reference/projects/transform-nodes/variable-creation-methods/common-elements#variable) or [literal](https://docs.redivis.com/reference/projects/transform-nodes/variable-creation-methods/common-elements#literal) | any [integer](https://docs.redivis.com/reference/datasets/variables#integer), [float](https://docs.redivis.com/reference/datasets/variables#float) | true     | -                   |
| `@expression_2` | [variable](https://docs.redivis.com/reference/projects/transform-nodes/variable-creation-methods/common-elements#variable) or [literal](https://docs.redivis.com/reference/projects/transform-nodes/variable-creation-methods/common-elements#literal) | any [integer](https://docs.redivis.com/reference/datasets/variables#integer), [float](https://docs.redivis.com/reference/datasets/variables#float) | true     | -                   |

### Sign

Returns the sign (-1, 0, +1) of a numeric variable –> [learn more](https://cloud.google.com/bigquery/docs/reference/standard-sql/functions-and-operators#sign)

```sql
SIGN(@variable)
```

#### Return type

integer

#### Parameters

| Name        | Type                                                                                                                       | Allowed values                                                                                                                                     | Required | Placeholder (in UI) |
| ----------- | -------------------------------------------------------------------------------------------------------------------------- | -------------------------------------------------------------------------------------------------------------------------------------------------- | -------- | ------------------- |
| `@variable` | [variable](https://docs.redivis.com/reference/projects/transform-nodes/variable-creation-methods/common-elements#variable) | any [integer](https://docs.redivis.com/reference/datasets/variables#integer), [float](https://docs.redivis.com/reference/datasets/variables#float) | true     | -                   |

### Sqrt

Compute the square root of a value; generates an error if the variable is less than 0 –> [learn more](https://cloud.google.com/bigquery/docs/reference/standard-sql/functions-and-operators#sqrt)

```sql
SQRT(@expression)
```

#### Return type

float

#### Parameters

| Name          | Type                                                                                                                                                                                                                                                   | Allowed values                                                                                                                                     | Required | Placeholder (in UI) |
| ------------- | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------ | -------------------------------------------------------------------------------------------------------------------------------------------------- | -------- | ------------------- |
| `@expression` | [variable](https://docs.redivis.com/reference/projects/transform-nodes/variable-creation-methods/common-elements#variable) or [literal](https://docs.redivis.com/reference/projects/transform-nodes/variable-creation-methods/common-elements#literal) | any [integer](https://docs.redivis.com/reference/datasets/variables#integer), [float](https://docs.redivis.com/reference/datasets/variables#float) | true     | -                   |

### Truncate

Similar to round, but rounds to the nearest integer whose absolute value is not greater than the absolute value of the provided variable (always rounds towards zero) –> [learn more](https://cloud.google.com/bigquery/docs/reference/standard-sql/functions-and-operators#trunc)

```sql
TRUNC(@expression[, @literal])
```

#### Return type

float

#### Parameters

| Name          | Type                                                                                                                                                                                                                                                   | Allowed values                                                                                                                                     | Required | Placeholder (in UI) |
| ------------- | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------ | -------------------------------------------------------------------------------------------------------------------------------------------------- | -------- | ------------------- |
| `@expression` | [variable](https://docs.redivis.com/reference/projects/transform-nodes/variable-creation-methods/common-elements#variable) or [literal](https://docs.redivis.com/reference/projects/transform-nodes/variable-creation-methods/common-elements#literal) | any [integer](https://docs.redivis.com/reference/datasets/variables#integer), [float](https://docs.redivis.com/reference/datasets/variables#float) | true     | -                   |
| `@literal`    | [literal](https://docs.redivis.com/reference/projects/transform-nodes/variable-creation-methods/common-elements#literal)                                                                                                                               | any [integer](https://docs.redivis.com/reference/datasets/variables#integer)                                                                       | false    | -                   |


---

# 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 dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter, and the optional `goal` query parameter:

```
GET https://docs.redivis.com/reference/workflows/transforms/variable-creation-methods/math.md?ask=<question>&goal=<endgoal>
```

`ask` is the immediate question: it should be specific, self-contained, and written in natural language.
`goal` is optional and describes the broader end goal you are ultimately trying to accomplish on behalf of the user. GitBook uses it to tailor the answer towards what is most useful for that goal.

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.
