# Math Formulas and Operators

## Abs&#x20;

**Formula**

`=abs(<number>)`

**Description**

Returns the absolute value of a given number.

**Arguments**

| Argument | Required (Y/N) | Description                             |
| -------- | -------------- | --------------------------------------- |
| number   | Y              | The number to get the absolute value of |

**Examples**

> \=abs(5) => 5
>
> \=abs(-5) => 5
>
> \=abs(0) => 0

## Add +

#### Formula

`=add(<input 1>, <input 2>...,[input n])`

`=<Input1>+<Input2>...+[input n]`

#### Description

Adds all given numeric inputs.

#### Arguments

| Argument | Required (Y/N) | Description                                      |
| -------- | -------------- | ------------------------------------------------ |
| Input1   | Y              | The first input to be added                      |
| input2   | Y              | The second and any additional inputs to be added |
| input n  | N              | Any number of additional inputs                  |

#### Examples

> **Example 1:**
>
> \=add($"New Users", $"Current Users")&#x20;
>
> \=$"New Users"+$"Current Users"&#x20;
>
> **Example 2:**
>
> \=add($"Q1 Orders", $"Q2 Orders", $"Q3 Orders, $"Q4 Orders")&#x20;
>
> \=$"Q1 Orders"+$"Q2 Orders"+$"Q3 Orders+$"Q4 Orders"\
> \
> **Example 3:**\
> \=add(1, 1) will return 2
>
> \=1+1 will return 2

## Ceiling

**Formula**

`=ceiling(<input>)`

**Description**

Rounds a number up. Negative numbers are rounded towards 0. Calling this function without any input will return 0.

**Arguments**

| Argument | Required (Y/N) | Description              |
| -------- | -------------- | ------------------------ |
| input    | Y              | The number to be rounded |

**Examples**

> **Example 1:**
>
> \=ceiling(5.99999) => 6.0
>
> **Example 2:**
>
> \=ceiling(5.11115) => 6.0
>
> **Example 3:**
>
> \=ceiling(-5.11115) => -5.0

## Divide /

#### Formula

`=divide(<input1>, <input2>...,[input n])`

`=<input1>/<input2>`

#### Description

Divides all given inputs from left to right

#### Arguments

| Argument | Required (Y/N) | Description                                                          |
| -------- | -------------- | -------------------------------------------------------------------- |
| Input1   | Y              | The first input to be divided                                        |
| Input2   | Y              | The first input to divide by, and any additional inputs to divide by |
| Input n  | N              | Any additional number of inputs                                      |

#### **Examples**

> **Example 1:**
>
> \=divide($"Annual Cost", 12)&#x20;
>
> \=$"Annual Cost"/12
>
> **Example 2:**
>
> \=divide(10, 2, 2) will return 2.5
>
> \=10/2/2 will return 2.5

## Floor

**Formula**

`=floor(<input>)`

**Description**

Rounds a number down. Negative numbers are rounded away from 0. Calling this function without any inputs will return 0.

**Arguments**

| Argument | Required (Y/N) | Description              |
| -------- | -------------- | ------------------------ |
| input    | Y              | The number to be rounded |

**Examples**

> **Example 1:**
>
> \=floor(5.99999) => 5.0
>
> **Example 2:**
>
> \=floor(5.11115) => 5.0
>
> **Example 3:**
>
> \=floor(-5.11115) => -6.0

## Max

#### Formula

`=max(<input>,... [input n])`

#### Description

Finds the maximum value in a list of values.

#### Arguments

| Argument   | Required (Y/N) | Description                                          |
| ---------- | -------------- | ---------------------------------------------------- |
| Input      | Y              | The first input to be evaluated                      |
| \[Input n] | N              | The second and any additional inputs to be evaluated |

**Examples**

> **Example 1:**
>
> \=max($"International Sales, $"Domestic Sales")&#x20;
>
> **Example 2:**
>
> \=max(100, multiply(5,25), 90) = 125

## Min

#### Formula

`=min(<input1>, [input2], ...)`

#### Description

Finds the minimum value in a list of values.

#### Arguments

| Argument      | Required (Y/N) | Description                                          |
| ------------- | -------------- | ---------------------------------------------------- |
| Input         | Y              | The first input to be evaluated                      |
| \[Input,....] | N              | The second and any additional inputs to be evaluated |

#### Examples

> **Example 1:**
>
> \=min(currentdate(), $"Date of Purchase")
>
> **Example 2:**
>
> \=min(100, multiply(5, 25)) = 100

## Multiply \*

#### Formula

`=multiply(<input1>, [input2], ...)`

`= <input1>*[input2]`

#### Description

Multiplies all given inputs.

#### Arguments

| Argument     | Required (Y/N) | Description                                          |
| ------------ | -------------- | ---------------------------------------------------- |
| Input        | Y              | The first input to be evaluated                      |
| \[Input,...] | N              | The second and any additional inputs to be evaluated |

#### **Examples**

> **Example 1:**
>
> \=multiply($"Unit Cost", $"Monthly Purchases")
>
> \=$"Unit Cost"\*$"Monthly Purchases"
>
> **Example 2:**
>
> \=multiply(100, divide(25, 5)) will return 500
>
> \=100\*(25/5) will return 500

## **Round**

**Formula**

`=round(<input>, <precision>)`

**Description**

Rounds a number to the specified number of significant digits. Rounds halfway numbers away from 0. Calling this function without any inputs will return 0.

**Arguments**

| Argument  | Required (Y/N) | Description                                                                    |
| --------- | -------------- | ------------------------------------------------------------------------------ |
| input     | Y              | The number to be rounded                                                       |
| precision | Y              | The number of significant digits to keep. Defaults to 2 if nothing is provided |

**Examples**

> **Example 1:**
>
> \=round(5.99999, 2) => 6.00
>
> **Example 2:**
>
> \=round(5.11115, 2) => 5.11
>
> **Example 3:**
>
> \=round(5.11115, 4) => 5.1112
>
> **Example 4:**
>
> \=round(5.11114, 4) => 5.1111

## Subtract -

#### Formula

`=subtract(<input1>, [input2], ...)`

`=<input1>-<input2>...`

#### Description

Subtracts the inputs from left to right.

#### Arguments

| Argument     | Required (Y/N) | Description                                                                                                      |
| ------------ | -------------- | ---------------------------------------------------------------------------------------------------------------- |
| Input        | Y              | The first input to be subtracted from                                                                            |
| \[Input,...] | N              | The first input to subtract from the first input, and any additional inputs to subtract from the previous inputs |

#### **Examples**

> **Example 1:**
>
> \=subtract($"Worldwide Sales", $"Domestic Sales")&#x20;
>
> \=$"Worldwide Sales"-$"Domestic Sales"
>
> **Example 2:**
>
> \=subtract(100, 60, 30, 20) will return -10
>
> \=100-60-30-20 will return -10

## Sum "+"

#### Formula

`=sum(<input1>, [input2], ...)`

`=<input1>+[input2]...`

#### Descriptions

Adds all given inputs

#### Arguments

| Argument     | Required (Y/N) | Description                                                    |
| ------------ | -------------- | -------------------------------------------------------------- |
| Input        | Y              | The first input to be added                                    |
| \[Input,...] | N              | The second and any additional inputs to add to the first input |

#### **Examples**

> **Example 1:**
>
> \=sum($"International Sales", $"Domestic Sales")
>
> \=$"International Sales"+$"Domestic Sales"
>
> **Example 2:**
>
> \=sum(100, divide(100, 20)) will return 105
>
> \=100+(100/20) will return 105


---

# Agent Instructions: 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:

```
GET https://docs.osmos.io/data-transformations/formulas/math-formulas.md?ask=<question>
```

The question should be specific, self-contained, and written in natural language.
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.
