ABS
- ABS(value)[source]
Returns the absolute value of a number or numeric array.
The ABS function computes the absolute value of the input. For scalar numbers, it returns the positive equivalent. For array inputs the absolute value is computed element-wise and an array type is returned.
- Parameters:
value (
int|float|Operand) – The numeric input whose absolute value is to be computed.- Return type:
- Returns:
A Formula object representing the absolute value of the input. For arrays, the absolute value is computed element-wise.
- Raises:
ValueError – If the input is not a numeric type.
Examples
Absolute value of a scalar:
ABS(-5) # Returns 5
Absolute value of a decimal:
ABS(-3.7) # Returns 3.7
Absolute value of a numeric array:
ABS([-1, -2, 3]) # Returns [1, 2, 3]
``value`` — accepted types
DECIMAL
DECIMAL_ARRAY
INTEGER
INTEGER_ARRAY
Return types
DECIMAL
DECIMAL_ARRAY
INTEGER
INTEGER_ARRAY