LogoLogo
About
  • Guides
  • BDK
  • REST API
  • Release Notes
  • Numbers
    • Overview
    • Increase a Number by a Percentage
    • Reduce a Number by a Percentage
    • Truncate a Number
Powered by GitBook
On this page
  • Overview
  • Syntax
  • Examples

Was this helpful?

Export as PDF
  1. Numbers

Truncate a Number

Truncates a decimal number to a specified precision without rounding.

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.

truncate the number with

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.

the number is

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

the precision is

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

Examples

1. Truncate a Number (No Specified Precision)

truncate the number with
    the number is 123.4567

the number 123.0

2. Truncate a Number with Precision 3

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

the number 123.456

3. Truncate a Number with Precision 0

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

the number 3.0

4. Truncate a Negative Decimal

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

the number -3.141

5. Truncate a Number (Alternative Syntax)

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

the number 123.45

Last updated 3 days ago

Was this helpful?