UltipaDocs
Try Playground
  • Introduction
  • Terminologies
    • Graphset
    • Schema
    • Property
    • Constraints
    • Insert
    • Overwrite or Insert
    • Upsert
    • Update
    • Delete
    • Find Nodes
    • Find Edges
      • AB
      • Autonet
      • Spread
      • Path Template
      • K-Hop
      • K-Hop Template
    • GROUP BY
    • ORDER BY
    • SKIP
    • LIMIT
    • WHERE
    • RETURN
    • WITH
    • UNCOLLECT
    • UNION
    • UNION ALL
    • CALL
    • All Functions
    • Path Functions
    • Aggregate Functions
    • Mathematical Functions
    • Trigonometric Functions
    • String Functions
    • List Functions
    • Datetime Functions
    • Spatial Functions
    • Table Functions
    • Null Functions
    • Type Conversion Functions
  • Operators
  • Expressions
    • Index
    • Full-text Index
    • Vector Index
    • Cache
    • Overview
    • Managing HDC Graphs
    • HDC Graph Queries
    • Process
    • Job
    • Execution Plan
    • Alias
    • Filter
    • Values and Types
    • Data Flow in Queries
    • Comments
    • Reserved Words
  • Access Control
  1. Docs
  2. /
  3. UQL
  4. /
  5. Functions

Mathematical Functions

abs()

Returns the absolute value of a given number.

Syntaxabs(<num>)
ArgumentsNameTypeDescription
<num>NumericThe target number
Return TypeUINT
UQL
return abs(-2.32)

Result:

abs(-2.32)
2.32

ceil()

Rounds a given number up to the nearest integer.

Syntaxceil(<num>)
ArgumentsNameTypeDescription
<num>NumericThe target number
Return TypeINT
UQL
uncollect [-2.92, 4.2] as item
return ceil(item)

Result:

ceil(item)
-2
5

floor()

Rounds a given number down to the nearest integer.

Syntaxfloor(<num>)
ArgumentsNameTypeDescription
<num>NumericThe target number
Return TypeINT
UQL
uncollect [-2.92, 4.2] as item
return floor(item)

Result:

floor(item)
-3
4

pi()

Returns the mathematical constant π (pi) approximately equal to 3.14159. Pi is the ratio of a circle's circumference to its diameter in Euclidean geometry.

Syntaxpi()
Return TypeDOUBLE
UQL
return pi()

Result:

pi()
3.14159265358979

pow()

Raises a number to the power of another number.

Syntaxpower(<base>, <exponent>)
ArgumentsNameTypeDescription
<base>NumericThe number to be raised to a power
<exponent>NumericThe power to which the base is raised
Return TypeDOUBLE
UQL
return pow(2, 4)

Result:

pow(2, 4)
16

round()

Returns the nearest value of a given number, rounded to a specified position of digits. If two nearest values are equidistant, it returns the one with the larger absolute value.

Syntaxround(<num>, [<digit>])
ArgumentsNameTypeDescription
<num>NumericThe target number to be rounded
<digit>INTThe position of digits to keep:
  • ...
  • -2 rounds to the hundreds place
  • -1 rounds to the tens place
  • 0 rounds to the nearest integer (default)
  • 1 rounds to one decimal place
  • 2 rounds to two decimal places
  • ...
Return TypeDOUBLE
UQL
return round(3.1415926, 3)

Result:

round(3.1415926, 3)
3.142

sqrt()

Computes the square root of a given number.

Syntaxsqrt(<num>)
ArgumentsNameTypeDescription
<num>NumericThe target number
Return TypeDOUBLE
UQL
return sqrt(16)

Result:

sqrt(16)
4