# Truncate a Number

### Overview

This procedure removes digits from a decimal number beyond a specified number of decimal places, effectively shortening the number without rounding it up or down. If no precision is provided, the number is truncated to an integer (zero decimal places).

### Syntax

Below is a line-by-line overview of the automation syntax. Expand each line to learn more.

<details>

<summary><kbd>truncate the number with</kbd></summary>

**What does it do?** Starts the truncation operation.

**Where does it go?** This phrase should be written on a new line.

**Is it required?** ✅ Yes — This phrase is **required** in the syntax.

**Does it require input data?** ⛔ No — This phrase does *not* require input data.

</details>

<details>

<summary><kbd>the number is</kbd></summary>

**What does it do?** Specifies a decimal number to be truncated. This is optional if `the number` is already defined earlier in the automation.

**Where does it go?** This phrase should be indented beneath `truncate the number with`.

**Is it required?** 🌟 No — This phrase is **optional** in the syntax.

**Does it require input data?** ✅ Yes — A **Decimal** value should be specified.

**Example:** `the number is 123.45678`

</details>

<details>

<summary><kbd>the precision is</kbd></summary>

**What does it do?** Specifies the number of decimal places to truncate to. If not specified, the number will be truncated to an integer.

**Where does it go?** This phrase should be indented beneath `truncate the number with`.

**Is it required?** 🌟 No — This phrase is **optional** in the syntax.

**Does it require input data?** ✅ Yes — A **Integer** value should be specified.

**Example:** `the precision is 2`

</details>

### Examples

#### 1. Truncate a Number (No Specified Precision)

{% tabs %}
{% tab title="Automation" %}

```
truncate the number with
    the number is 123.4567
```

{% endtab %}

{% tab title="Results" %}
**the number** 123.0
{% endtab %}
{% endtabs %}

#### 2. Truncate a Number with Precision 3

{% tabs %}
{% tab title="Automation" %}

```
the number is 123.4567
truncate the number with
    the precision is 3
```

{% endtab %}

{% tab title="Results" %}
**the number** 123.456
{% endtab %}
{% endtabs %}

#### 3. Truncate a Number with Precision 0

{% tabs %}
{% tab title="Automation" %}

```
the number is 3.14159
truncate the number with
    the precision is 0
```

{% endtab %}

{% tab title="Results" %}
**the number** 3.0
{% endtab %}
{% endtabs %}

#### 4. Truncate a Negative Decimal

{% tabs %}
{% tab title="Automation" %}

```
the number is -3.14159
truncate the number with
    the precision is 3
```

{% endtab %}

{% tab title="Results" %}
**the number** -3.141
{% endtab %}
{% endtabs %}

#### 5. Truncate a Number (Alternative Syntax)

{% tabs %}
{% tab title="Automation" %}

```
the number is 123.4567
truncate the number with
    the precision is 2
```

{% endtab %}

{% tab title="Results" %}
**the number** 123.45
{% endtab %}
{% endtabs %}


---

# 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.kognitos.com/legacy/legacy-experience/automation-areas/numbers/truncate-a-number.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.
