Skip to main content

Unary Mathematical Functions

HelixQL provides a rich set of single-argument mathematical functions for transforming numeric values, including absolute values, roots, logarithms, exponentials, and rounding operations.

Available Functions

ABS - Absolute Value

Returns the absolute value of a number.

SQRT - Square Root

Returns the square root of a non-negative number.

LN - Natural Logarithm

Returns the natural logarithm (base e) of a positive number.

LOG10 - Base-10 Logarithm

Returns the base-10 logarithm of a positive number.

LOG - Custom Base Logarithm

Returns the logarithm of x with a custom base.

EXP - Exponential

Returns e raised to the power of x.

CEIL - Ceiling

Rounds up to the nearest integer.

FLOOR - Floor

Rounds down to the nearest integer.

ROUND - Round

Rounds to the nearest integer.
When using the SDKs or curling the endpoint, the query name must match what is defined in the queries.hx file exactly.

Example 1: Distance calculations with SQRT

Calculate Euclidean distances between points:
Here’s how to run the query using the SDKs or curl

Example 2: Logarithmic scaling with LN and LOG10

Use logarithms for normalization and scaling:
Here’s how to run the query using the SDKs or curl

Example 3: Exponential decay with EXP

Model time-based decay using exponential functions:
Here’s how to run the query using the SDKs or curl

Rounding Functions

CEIL, FLOOR, and ROUND provide different rounding behaviors:
Use rounding for display formatting or bucketing:

Domain Restrictions

Some functions have domain restrictions:
  • SQRT(x): x must be non-negative
  • LN(x), LOG10(x), LOG(x, base): x must be positive
  • LOG(x, base): base must be positive and not equal to 1

Use in Weight Calculations

Unary math functions are powerful in shortest path weight calculations:

Arithmetic Functions

ADD, SUB, MUL, DIV, POW, MOD

Constants

PI and E constants

Custom Weights

Use in shortest path calculations

Math Overview

Overview of all math functions