ABS (NoSQL query)

APPLIES TO: NoSQL

Returns the absolute (positive) value of the specified numeric expression.

Syntax

ABS(<numeric_expr>)  

Arguments

Description
numeric_expr A numeric expression.

Return types

Returns a numeric expression.

Examples

The following example shows the results of using this function on three different numbers.

SELECT VALUE { 
    absoluteNegativeOne: ABS(-1),
    absoluteZero: ABS(0),
    absoluteOne: ABS(1) 
}
[
  {
    "absoluteNegativeOne": 1,
    "absoluteZero": 0,
    "absoluteOne": 1
  }
]

Remarks

  • This function benefits from the use of a range index.