abs
abs
🔢 NumberReturn the absolute value (magnitude without sign) of a number
abs(number) → number number The absolute value of the input number; null if input is null
The abs function returns the absolute value (magnitude without sign) of the input number.
Edge Cases
Section titled “Edge Cases”- If
numberisnull, returnsnull abs(-0)returns0abs(0)returns0- Preserves decimal precision:
abs(-3.14)returns3.14
Examples
Section titled “Examples”| eval abs_delta = abs(difference)
Creates a new field abs_delta with the absolute value of difference.
| eval error_magnitude = abs(deviation_percent)
Calculates the absolute error in a percentage calculation.
| stats avg(abs(latency_offset))
Calculates the average absolute latency offset.
Used In
Section titled “Used In”eval— to create or transform numeric fields