abs

Generic Description

Returns the absolute magnitude of a signed integer or floating-point value. It is documented separately because numeric transforms change ranking, thresholds, and buckets in ways planner tools must not guess.

Simple example:

RETURN abs(-7.5) AS value

Consumer-Level Explanation

Use it for distance from a target, positive error size, or magnitude-only thresholds where direction is handled separately. Prefer this function when the transformation is a deliberate part of the model or report, and name the derived value in a WITH stage when it will be reused.

More Detailed Explanation

abs is scalar math, so it is evaluated per row after graph patterns, procedure output, or map projections have produced values. Keep it close to the query when thresholds, ranking, and derived fields need to be auditable and reproducible.

Advanced Example

This example applies abs to a named score component after matching graph data, making the derived metric reviewable before ordering.

MATCH (d:Document)
WITH d, properties(d).prize - 3.0 AS priority_delta
RETURN d.title AS document,
       abs(priority_delta) AS distance_from_target
ORDER BY distance_from_target DESC

Real Use Cases

Real Limitations And Tradeoffs