Sqrt
Synopsis
Calculates the square root of a numeric value.
Schema
- sqrt:
field: <ident>
value: <string>
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 square root result |
value | Y | - | Value to process - can be a literal value or field reference |
description | N | - | Explanatory note |
if | N | - | Condition to run |
ignore_failure | N | false | Continue processing if square root calculation 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
Calculates the square root of a numeric value and stores the result in the target field. The processor can extract values from existing fields or use literal numeric values.
The square root calculation uses the math.Sqrt
function from Go's standard library, which provides accurate results for all non-negative numbers.
The processor is useful for mathematical transformations, statistical calculations, and implementing various formulas that require square root operations.
Attempting to calculate the square root of a negative number will result in an error unless ignore_failure
is set to true
. Real-valued square roots are only defined for non-negative numbers.
Examples
Basic
Calculating the square root of a literal value... |
|
calculates and stores the result: |
|
Field-Based
Calculating square root of a field value... |
|
computes radius from area: |
|
Statistical
Calculating standard deviation from variance... |
|
derives standard deviation: |
|
Distances
Calculating Euclidean distance... |
|
implements the distance formula: |
|
Error Handling
Handling potential negative values... |
|
continues execution: |
|