Round
Synopsis
Rounds numeric values to a specified precision.
Schema
- round:
field: <ident>
value: <string>
precision: <numeric>
description: <text>
if: <script>
ignore_failure: <boolean>
ignore_missing: <boolean>
on_failure: <processor[]>
on_success: <processor[]>
tag: <string>
Configuration
The following fields are used to define the processor:
Field | Required | Default | Description |
---|---|---|---|
field | Y | - | Target field to store the rounded value |
value | Y | - | Value to round - can be a literal value or field reference |
precision | Y | - | Number of decimal places to round to |
description | N | - | Explanatory note |
if | N | - | Condition to run |
ignore_failure | N | false | Continue processing if rounding fails |
ignore_missing | N | false | Skip if referenced fields don't exist |
on_failure | N | - | Error handling processors |
on_success | N | - | Success handling processors |
tag | N | - | Identifier |
Details
Rounds a numeric value to a specified number of decimal places and stores the result in the target field. The processor can extract values from existing fields or use literal numeric values.
Rounding uses half to even (banker's rounding) when the fractional part is exactly 0.5. This method is statistically unbiased and is the default for IEEE 754 floating-point operations.
The processor is useful for normalizing numeric data, improving readability, ensuring consistent precision across values, and preparing data for display or further calculations.
Very large numbers might lose precision during floating-point operations. Consider using a different approach for values that require exact decimal representation, such as currency amounts in financial applications.
Examples
Basic
Rounding a value to the nearest integer... |
|
rounds to whole number: |
|
Precision
Rounding to two decimal places... |
|
provides consistent precision: |
|
In-Place
Updating a field with its rounded value... |
|
modifies the original field: |
|
Batch
Applying consistent rounding to multiple values... |
|
standardizes precision across all statistics: |
|
Formatting
Preparing values for user display... |
|
creates display-friendly values: |
|